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

Windows: Fixed an OpenGL scale issue in high-DPI plug-ins

This commit is contained in:
ed 2020-03-17 15:59:10 +00:00
parent e4af85e07b
commit d77dae186d

View file

@ -296,15 +296,17 @@ public:
{
if (auto* peer = component.getPeer())
{
auto localBounds = component.getLocalBounds();
auto displayScale = Desktop::getInstance().getDisplays().findDisplayForRect (component.getTopLevelComponent()->getScreenBounds()).scale;
auto newArea = peer->getComponent().getLocalArea (&component, localBounds).withZeroOrigin() * displayScale;
#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
auto newScale = getScaleFactorForWindow (nativeContext->getNativeHandle());
#else
auto newScale = Desktop::getInstance().getDisplays().findDisplayForRect (component.getTopLevelComponent()->getScreenBounds()).scale;
auto newScale = displayScale;
#endif
auto localBounds = component.getLocalBounds();
auto newArea = peer->getComponent().getLocalArea (&component, localBounds).withZeroOrigin() * newScale;
if (scale != newScale || viewportArea != newArea)
{
scale = newScale;