diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp index c51c47925e..c6e1930086 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp @@ -118,9 +118,14 @@ void ComponentPeer::handlePaint (LowLevelGraphicsContext& contextToPaintTo) g.addTransform (AffineTransform::scale (peerBounds.getWidth() / (float) component.getWidth(), peerBounds.getHeight() / (float) component.getHeight())); - #if JUCE_ENABLE_REPAINT_DEBUGGING - g.saveState(); + #if JUCE_ENABLE_REPAINT_DEBUGGING + #ifdef JUCE_IS_REPAINT_DEBUGGING_ACTIVE + if (JUCE_IS_REPAINT_DEBUGGING_ACTIVE) #endif + { + g.saveState(); + } + #endif JUCE_TRY { @@ -128,18 +133,23 @@ void ComponentPeer::handlePaint (LowLevelGraphicsContext& contextToPaintTo) } JUCE_CATCH_EXCEPTION - #if JUCE_ENABLE_REPAINT_DEBUGGING - // enabling this code will fill all areas that get repainted with a colour overlay, to show - // clearly when things are being repainted. - g.restoreState(); - - static Random rng; - - g.fillAll (Colour ((uint8) rng.nextInt (255), - (uint8) rng.nextInt (255), - (uint8) rng.nextInt (255), - (uint8) 0x50)); + #if JUCE_ENABLE_REPAINT_DEBUGGING + #ifdef JUCE_IS_REPAINT_DEBUGGING_ACTIVE + if (JUCE_IS_REPAINT_DEBUGGING_ACTIVE) #endif + { + // enabling this code will fill all areas that get repainted with a colour overlay, to show + // clearly when things are being repainted. + g.restoreState(); + + static Random rng; + + g.fillAll (Colour ((uint8) rng.nextInt (255), + (uint8) rng.nextInt (255), + (uint8) rng.nextInt (255), + (uint8) 0x50)); + } + #endif /** If this fails, it's probably be because your CPU floating-point precision mode has been set to low.. This setting is sometimes changed by things like Direct3D, and can diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index ce8096dfb2..34c6bd08a4 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -261,8 +261,13 @@ public: { Graphics g (llgc); - #if JUCE_ENABLE_REPAINT_DEBUGGING - g.saveState(); + #if JUCE_ENABLE_REPAINT_DEBUGGING + #ifdef JUCE_IS_REPAINT_DEBUGGING_ACTIVE + if (JUCE_IS_REPAINT_DEBUGGING_ACTIVE) + #endif + { + g.saveState(); + } #endif JUCE_TRY @@ -271,16 +276,21 @@ public: } JUCE_CATCH_EXCEPTION - #if JUCE_ENABLE_REPAINT_DEBUGGING - // enabling this code will fill all areas that get repainted with a colour overlay, to show - // clearly when things are being repainted. - g.restoreState(); + #if JUCE_ENABLE_REPAINT_DEBUGGING + #ifdef JUCE_IS_REPAINT_DEBUGGING_ACTIVE + if (JUCE_IS_REPAINT_DEBUGGING_ACTIVE) + #endif + { + // enabling this code will fill all areas that get repainted with a colour overlay, to show + // clearly when things are being repainted. + g.restoreState(); - static Random rng; - g.fillAll (Colour ((uint8) rng.nextInt (255), - (uint8) rng.nextInt (255), - (uint8) rng.nextInt (255), - (uint8) 0x50)); + static Random rng; + g.fillAll (Colour ((uint8) rng.nextInt (255), + (uint8) rng.nextInt (255), + (uint8) rng.nextInt (255), + (uint8) 0x50)); + } #endif }