1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-30 02:50:05 +00:00

Avoided some judder when dragging windows using a global scale factor.

This commit is contained in:
jules 2013-09-20 11:17:59 +01:00
parent ca902e0122
commit fa82952520

View file

@ -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<int> unscaledScreenPosToScaled (float scale, const Rectangle<int>& pos) noexcept
{
return scale != 1.0f ? Rectangle<int> (roundToInt (pos.getX() / scale),
roundToInt (pos.getY() / scale),
roundToInt (pos.getWidth() / scale),
roundToInt (pos.getHeight() / scale)) : pos;
}
static Rectangle<int> scaledScreenPosToUnscaled (float scale, Rectangle<int>& pos) noexcept
{
return scale != 1.0f ? Rectangle<int> (roundToInt (pos.getX() * scale),
roundToInt (pos.getY() * scale),
roundToInt (pos.getWidth() * scale),
roundToInt (pos.getHeight() * scale)) : pos;
}
template <typename PointOrRect>
static PointOrRect unscaledScreenPosToScaled (PointOrRect pos) noexcept
{