diff --git a/modules/juce_gui_basics/components/juce_Component.cpp b/modules/juce_gui_basics/components/juce_Component.cpp index ebae01c3d5..78cfc3225d 100644 --- a/modules/juce_gui_basics/components/juce_Component.cpp +++ b/modules/juce_gui_basics/components/juce_Component.cpp @@ -230,6 +230,24 @@ struct Component::ComponentHelpers return scale != 1.0f ? pos * scale : pos; } + // For these, we need to avoid getSmallestIntegerContainer being used, which causes + // judder when moving windows + static Rectangle unscaledScreenPosToScaled (float scale, const Rectangle& pos) noexcept + { + return scale != 1.0f ? Rectangle (roundToInt (pos.getX() / scale), + roundToInt (pos.getY() / scale), + roundToInt (pos.getWidth() / scale), + roundToInt (pos.getHeight() / scale)) : pos; + } + + static Rectangle scaledScreenPosToUnscaled (float scale, Rectangle& pos) noexcept + { + return scale != 1.0f ? Rectangle (roundToInt (pos.getX() * scale), + roundToInt (pos.getY() * scale), + roundToInt (pos.getWidth() * scale), + roundToInt (pos.getHeight() * scale)) : pos; + } + template static PointOrRect unscaledScreenPosToScaled (PointOrRect pos) noexcept {