| @@ -891,12 +891,6 @@ public: | |||||
| void repaint (const Rectangle<int>& area) override | void repaint (const Rectangle<int>& area) override | ||||
| { | { | ||||
| #if JucePlugin_Build_AAX || JucePlugin_Build_RTAS || JucePlugin_Build_AUv3 || JucePlugin_Build_AU || JucePlugin_Build_VST3 || JucePlugin_Build_VST | |||||
| const bool shouldThrottle = true; | |||||
| #else | |||||
| const bool shouldThrottle = areAnyWindowsInLiveResize(); | |||||
| #endif | |||||
| // In 10.11 changes were made to the way the OS handles repaint regions, and it seems that it can | // In 10.11 changes were made to the way the OS handles repaint regions, and it seems that it can | ||||
| // no longer be trusted to coalesce all the regions, or to even remember them all without losing | // no longer be trusted to coalesce all the regions, or to even remember them all without losing | ||||
| // a few when there's a lot of activity. | // a few when there's a lot of activity. | ||||
| @@ -905,21 +899,19 @@ public: | |||||
| deferredRepaints.add ((float) area.getX(), (float) ([view frame].size.height - area.getBottom()), | deferredRepaints.add ((float) area.getX(), (float) ([view frame].size.height - area.getBottom()), | ||||
| (float) area.getWidth(), (float) area.getHeight()); | (float) area.getWidth(), (float) area.getHeight()); | ||||
| // already a timer running -> stop | |||||
| if (isTimerRunning()) return; | |||||
| if (isTimerRunning()) | |||||
| return; | |||||
| const uint32 now = Time::getMillisecondCounter(); | const uint32 now = Time::getMillisecondCounter(); | ||||
| uint32 msSinceLastRepaint = | |||||
| (lastRepaintTime >= now ? now - lastRepaintTime | |||||
| : (std::numeric_limits<uint32>::max() - lastRepaintTime) + now); | |||||
| uint32 msSinceLastRepaint = (lastRepaintTime >= now) ? now - lastRepaintTime | |||||
| : (std::numeric_limits<uint32>::max() - lastRepaintTime) + now; | |||||
| static uint32 minimumRepaintInterval = 1000 / 30; // 30fps | static uint32 minimumRepaintInterval = 1000 / 30; // 30fps | ||||
| // When windows are being resized, artificially throttling high-frequency repaints helps | // When windows are being resized, artificially throttling high-frequency repaints helps | ||||
| // to stop the event queue getting clogged, and keeps everything working smoothly. | // to stop the event queue getting clogged, and keeps everything working smoothly. | ||||
| // For some reason Logic also needs this throttling to recored parameter events correctly. | // For some reason Logic also needs this throttling to recored parameter events correctly. | ||||
| if (shouldThrottle | |||||
| && msSinceLastRepaint < minimumRepaintInterval) | |||||
| if (msSinceLastRepaint < minimumRepaintInterval && shouldThrottleRepaint()) | |||||
| { | { | ||||
| startTimer (static_cast<int> (minimumRepaintInterval - msSinceLastRepaint)); | startTimer (static_cast<int> (minimumRepaintInterval - msSinceLastRepaint)); | ||||
| return; | return; | ||||
| @@ -928,6 +920,11 @@ public: | |||||
| setNeedsDisplayRectangles(); | setNeedsDisplayRectangles(); | ||||
| } | } | ||||
| static bool shouldThrottleRepaint() | |||||
| { | |||||
| return areAnyWindowsInLiveResize() || ! JUCEApplication::isStandaloneApp(); | |||||
| } | |||||
| void timerCallback() override | void timerCallback() override | ||||
| { | { | ||||
| setNeedsDisplayRectangles(); | setNeedsDisplayRectangles(); | ||||