mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-27 02:20:05 +00:00
D2D: Avoid calling setPhysicalPixelScaleFactor
This commit is contained in:
parent
e005a41d6b
commit
c2d86693ff
5 changed files with 10 additions and 12 deletions
|
|
@ -471,7 +471,7 @@ public:
|
|||
deviceResources.deviceContext.context->Clear (backgroundColor);
|
||||
}
|
||||
|
||||
virtual SavedState* startFrame()
|
||||
virtual SavedState* startFrame (float dpiScale)
|
||||
{
|
||||
prepare();
|
||||
|
||||
|
|
@ -495,7 +495,7 @@ public:
|
|||
// Init device context transform
|
||||
deviceResources.deviceContext.resetTransform();
|
||||
|
||||
const auto effectiveDpi = USER_DEFAULT_SCREEN_DPI * owner.getPhysicalPixelScaleFactor();
|
||||
const auto effectiveDpi = USER_DEFAULT_SCREEN_DPI * dpiScale;
|
||||
deviceResources.deviceContext.context->SetDpi (effectiveDpi, effectiveDpi);
|
||||
|
||||
// Start drawing
|
||||
|
|
@ -760,10 +760,10 @@ private:
|
|||
Direct2DGraphicsContext::Direct2DGraphicsContext() = default;
|
||||
Direct2DGraphicsContext::~Direct2DGraphicsContext() = default;
|
||||
|
||||
bool Direct2DGraphicsContext::startFrame()
|
||||
bool Direct2DGraphicsContext::startFrame (float dpiScale)
|
||||
{
|
||||
auto pimpl = getPimpl();
|
||||
currentState = pimpl->startFrame();
|
||||
currentState = pimpl->startFrame (dpiScale);
|
||||
|
||||
if (currentState == nullptr)
|
||||
return false;
|
||||
|
|
@ -781,7 +781,7 @@ bool Direct2DGraphicsContext::startFrame()
|
|||
setFont (currentState->font);
|
||||
currentState->updateCurrentBrush();
|
||||
|
||||
addTransform (AffineTransform::scale ((float) getPhysicalPixelScaleFactor()));
|
||||
addTransform (AffineTransform::scale (dpiScale));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public:
|
|||
void fillRoundedRectangle (const Rectangle<float>& area, float cornerSize) override;
|
||||
|
||||
//==============================================================================
|
||||
bool startFrame();
|
||||
bool startFrame (float dpiScale);
|
||||
void endFrame();
|
||||
|
||||
virtual Image createSnapshot() const { return {}; }
|
||||
|
|
|
|||
|
|
@ -486,7 +486,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
SavedState* startFrame() override
|
||||
SavedState* startFrame (float dpiScale) override
|
||||
{
|
||||
if (resizing)
|
||||
{
|
||||
|
|
@ -494,7 +494,7 @@ public:
|
|||
setSize (getClientRect());
|
||||
}
|
||||
|
||||
auto savedState = Pimpl::startFrame();
|
||||
auto savedState = Pimpl::startFrame (dpiScale);
|
||||
|
||||
// If a new frame is starting, clear deferredAreas in case repaint is called
|
||||
// while the frame is being painted to ensure the new areas are painted on the
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ Direct2DImageContext::Direct2DImageContext (Direct2DPixelData::Ptr targetIn)
|
|||
metrics = Direct2DMetricsHub::getInstance()->imageContextMetrics;
|
||||
#endif
|
||||
|
||||
startFrame();
|
||||
startFrame (1.0f);
|
||||
}
|
||||
|
||||
Direct2DImageContext::~Direct2DImageContext()
|
||||
|
|
|
|||
|
|
@ -4774,9 +4774,7 @@ private:
|
|||
//
|
||||
// Direct2DLowLevelGraphicsContext::endFrame calls ID2D1DeviceContext::EndDraw to finish painting
|
||||
// and then tells the swap chain to present the next swap chain back buffer.
|
||||
direct2DContext->setPhysicalPixelScaleFactor ((float) peer.getPlatformScaleFactor());
|
||||
|
||||
if (! direct2DContext->startFrame())
|
||||
if (! direct2DContext->startFrame ((float) peer.getPlatformScaleFactor()))
|
||||
return;
|
||||
|
||||
peer.handlePaint (*direct2DContext);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue