From 6f092d602d93f374d4cca63550a10046368e1196 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 22 Dec 2015 10:26:03 +0000 Subject: [PATCH] Rendering optimisation when filling off-screen paths --- modules/juce_graphics/native/juce_RenderingHelpers.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/juce_graphics/native/juce_RenderingHelpers.h b/modules/juce_graphics/native/juce_RenderingHelpers.h index cd8cd368df..d906a12372 100644 --- a/modules/juce_graphics/native/juce_RenderingHelpers.h +++ b/modules/juce_graphics/native/juce_RenderingHelpers.h @@ -2266,7 +2266,13 @@ public: void fillPath (const Path& path, const AffineTransform& t) { if (clip != nullptr) - fillShape (new EdgeTableRegionType (clip->getClipBounds(), path, transform.getTransformWith (t)), false); + { + const AffineTransform trans (transform.getTransformWith (t)); + const Rectangle clipRect (clip->getClipBounds()); + + if (path.getBoundsTransformed (trans).getSmallestIntegerContainer().intersects (clipRect)) + fillShape (new EdgeTableRegionType (clipRect, path, trans), false); + } } void fillEdgeTable (const EdgeTable& edgeTable, const float x, const int y)