From 3e327a53907593c2d034090c6e1cb9efc4b728d0 Mon Sep 17 00:00:00 2001 From: hogliux Date: Wed, 30 May 2018 17:29:56 +0100 Subject: [PATCH] Ensured that any top-level component transforms are not applied twice --- modules/juce_gui_basics/windows/juce_ComponentPeer.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp index 11ce907574..d6540444df 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp @@ -109,11 +109,15 @@ void ComponentPeer::handlePaint (LowLevelGraphicsContext& contextToPaintTo) g.addTransform (component.getTransform()); auto peerBounds = getBounds(); + auto componentBounds = component.getLocalBounds(); - if (peerBounds.getWidth() != component.getWidth() || peerBounds.getHeight() != component.getHeight()) + if (component.isTransformed()) + componentBounds = componentBounds.transformedBy (component.getTransform()); + + if (peerBounds.getWidth() != componentBounds.getWidth() || peerBounds.getHeight() != componentBounds.getHeight()) // Tweak the scaling so that the component's integer size exactly aligns with the peer's scaled size - g.addTransform (AffineTransform::scale (peerBounds.getWidth() / (float) component.getWidth(), - peerBounds.getHeight() / (float) component.getHeight())); + g.addTransform (AffineTransform::scale (peerBounds.getWidth() / (float) componentBounds.getWidth(), + peerBounds.getHeight() / (float) componentBounds.getHeight())); #if JUCE_ENABLE_REPAINT_DEBUGGING #ifdef JUCE_IS_REPAINT_DEBUGGING_ACTIVE