mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
OpenGL: Allow setting window bounds from repaint callback
On Windows, the OpenGL context window sometimes receives a repaint request after moving between screens with different scale factors. If the screen has changed size/scale since the last paint operation, failing to invalidate the painted area may cause the screen contents to be drawn at the wrong scale until paint is next called.
This commit is contained in:
parent
02b5ab748a
commit
e64f87b26c
2 changed files with 7 additions and 8 deletions
|
|
@ -68,6 +68,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996 4100)
|
|||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wconversion",
|
||||
"-Wshadow",
|
||||
"-Wdeprecated-register",
|
||||
"-Wdeprecated-declarations",
|
||||
"-Wunused-parameter",
|
||||
"-Wdeprecated-writable-strings",
|
||||
"-Wnon-virtual-dtor",
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ public:
|
|||
//==============================================================================
|
||||
void paint (Graphics&) override
|
||||
{
|
||||
updateViewportSize (false);
|
||||
updateViewportSize();
|
||||
}
|
||||
|
||||
bool invalidateAll() override
|
||||
|
|
@ -352,7 +352,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
void updateViewportSize (bool canTriggerUpdate)
|
||||
void updateViewportSize()
|
||||
{
|
||||
JUCE_ASSERT_MESSAGE_THREAD
|
||||
|
||||
|
|
@ -400,9 +400,7 @@ public:
|
|||
(float) newArea.getHeight() / (float) localBounds.getHeight());
|
||||
|
||||
nativeContext->updateWindowPosition (peer->getAreaCoveredBy (component));
|
||||
|
||||
if (canTriggerUpdate)
|
||||
invalidateAll();
|
||||
invalidateAll();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -420,7 +418,7 @@ public:
|
|||
|
||||
if (lastScreenBounds != screenBounds)
|
||||
{
|
||||
updateViewportSize (true);
|
||||
updateViewportSize();
|
||||
lastScreenBounds = screenBounds;
|
||||
}
|
||||
}
|
||||
|
|
@ -523,7 +521,7 @@ public:
|
|||
|
||||
void handleResize()
|
||||
{
|
||||
updateViewportSize (true);
|
||||
updateViewportSize();
|
||||
|
||||
#if JUCE_MAC
|
||||
if (hasInitialised)
|
||||
|
|
@ -1052,7 +1050,7 @@ private:
|
|||
if (auto* cachedImage = CachedImage::get (comp))
|
||||
{
|
||||
cachedImage->start(); // (must wait until this is attached before starting its thread)
|
||||
cachedImage->updateViewportSize (true);
|
||||
cachedImage->updateViewportSize();
|
||||
|
||||
startTimer (400);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue