1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

D2D: Update Direct2DGraphicsContext::getPhysicalPixelScaleFactor to include context transform for consistency with other renderer backends

This commit is contained in:
reuk 2024-04-22 18:10:21 +01:00
parent c2d86693ff
commit 203e99c57d
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
2 changed files with 6 additions and 10 deletions

View file

@ -946,11 +946,6 @@ void Direct2DGraphicsContext::excludeClipRectangle (const Rectangle<int>& userSp
}
}
void Direct2DGraphicsContext::setPhysicalPixelScaleFactor (float f)
{
scale = f;
}
void Direct2DGraphicsContext::resetPendingClipList()
{
auto& transform = currentState->currentTransform;
@ -1403,7 +1398,12 @@ const Font& Direct2DGraphicsContext::getFont()
float Direct2DGraphicsContext::getPhysicalPixelScaleFactor() const
{
return scale;
if (currentState != nullptr)
return currentState->currentTransform.getPhysicalPixelScaleFactor();
// If this is hit, there's no frame in progress, so the scale factor isn't meaningful
jassertfalse;
return 1.0f;
}
void Direct2DGraphicsContext::drawRoundedRectangle (const Rectangle<float>& area, float cornerSize, float lineThickness)

View file

@ -113,9 +113,6 @@ public:
static int constexpr minFrameSize = 1;
static int constexpr maxFrameSize = 16384;
//==============================================================================
void setPhysicalPixelScaleFactor (float);
protected:
struct SavedState;
SavedState* currentState = nullptr;
@ -170,7 +167,6 @@ protected:
};
uint64_t frame = 0;
float scale = 1.0f;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Direct2DGraphicsContext)
};