mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
OpenGL: Respect result of getDesktopScaleFactor() for component hosting OpenGLContext
This commit is contained in:
parent
ac65cc5434
commit
90b89e92b2
1 changed files with 12 additions and 10 deletions
|
|
@ -447,10 +447,14 @@ public:
|
||||||
|
|
||||||
if (auto* peer = component.getPeer())
|
if (auto* peer = component.getPeer())
|
||||||
{
|
{
|
||||||
|
auto& desktop = Desktop::getInstance();
|
||||||
|
const auto localBounds = component.getLocalBounds();
|
||||||
|
const auto globalArea = component.getScreenBounds() * desktop.getGlobalScaleFactor();
|
||||||
|
|
||||||
#if JUCE_MAC
|
#if JUCE_MAC
|
||||||
updateScreen();
|
updateScreen();
|
||||||
|
|
||||||
const auto displayScale = Desktop::getInstance().getGlobalScaleFactor() * [this]
|
const auto displayScale = std::invoke ([this]
|
||||||
{
|
{
|
||||||
if (auto* view = getCurrentView())
|
if (auto* view = getCurrentView())
|
||||||
{
|
{
|
||||||
|
|
@ -462,16 +466,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
return areaAndScale.get().scale;
|
return areaAndScale.get().scale;
|
||||||
}();
|
});
|
||||||
#else
|
|
||||||
const auto displayScale = Desktop::getInstance().getDisplays()
|
|
||||||
.getDisplayForRect (component.getTopLevelComponent()
|
|
||||||
->getScreenBounds())
|
|
||||||
->scale;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const auto localBounds = component.getLocalBounds();
|
const auto newArea = globalArea.withZeroOrigin() * displayScale;
|
||||||
const auto newArea = peer->getComponent().getLocalArea (&component, localBounds).withZeroOrigin() * displayScale;
|
#else
|
||||||
|
const auto newArea = desktop.getDisplays()
|
||||||
|
.logicalToPhysical (globalArea)
|
||||||
|
.withZeroOrigin();
|
||||||
|
#endif
|
||||||
|
|
||||||
// On Windows some hosts (Pro Tools 2022.7) do not take the current DPI into account
|
// On Windows some hosts (Pro Tools 2022.7) do not take the current DPI into account
|
||||||
// when sizing plugin editor windows.
|
// when sizing plugin editor windows.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue