Browse Source

Ensured that any top-level component transforms are not applied twice

tags/2021-05-28
hogliux 7 years ago
parent
commit
3e327a5390
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      modules/juce_gui_basics/windows/juce_ComponentPeer.cpp

+ 7
- 3
modules/juce_gui_basics/windows/juce_ComponentPeer.cpp View File

@@ -109,11 +109,15 @@ void ComponentPeer::handlePaint (LowLevelGraphicsContext& contextToPaintTo)
g.addTransform (component.getTransform()); g.addTransform (component.getTransform());
auto peerBounds = getBounds(); 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 // 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 #if JUCE_ENABLE_REPAINT_DEBUGGING
#ifdef JUCE_IS_REPAINT_DEBUGGING_ACTIVE #ifdef JUCE_IS_REPAINT_DEBUGGING_ACTIVE


Loading…
Cancel
Save