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 issue with OpenGL rendering scale in plug-ins

This commit is contained in:
ed 2020-03-03 18:07:00 +00:00
parent e65ac0b2cd
commit 99a17ad3a9
2 changed files with 16 additions and 0 deletions

View file

@ -150,6 +150,14 @@ public:
struct Locker { Locker (NativeContext&) {} };
HWND getNativeHandle()
{
if (nativeWindow != nullptr)
return (HWND) nativeWindow->getNativeHandle();
return {};
}
private:
struct DummyComponent : public Component
{

View file

@ -66,6 +66,10 @@ private:
#endif
#if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE
extern JUCE_API double getScaleFactorForWindow (HWND);
#endif
//==============================================================================
class OpenGLContext::CachedImage : public CachedComponentImage,
private ThreadPoolJob
@ -292,7 +296,11 @@ public:
{
if (auto* peer = component.getPeer())
{
#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;
#endif
auto localBounds = component.getLocalBounds();
auto newArea = peer->getComponent().getLocalArea (&component, localBounds).withZeroOrigin() * newScale;