From 2a264390e83cc0eb946d1dc5c3b5eb83d0c5730c Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 30 May 2024 20:41:30 +0100 Subject: [PATCH] Direct2D: Update assertion to check for alignment against screen rather than current transform This assertion is intended to mirror the behaviour of an informational/performance diagnostic message raised by the D2D debugging layer. It seems the D2D diagnostic is raised when the proposed clip region is aligned to the screen, not to the current transform. Before this change, the assertion could incorrectly fire when clipping to transformed rectangles. This could be seen when clicking the star-shaped buttons in the ComponentTransformsDemo. With this change in place, the assertion will still fire when e.g. calling Graphics::reduceClipRegion on a screen-aligned rectangular path, but will not fire when this path is skewed/rotated etc. --- .../native/juce_Direct2DGraphicsContext_windows.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/juce_graphics/native/juce_Direct2DGraphicsContext_windows.cpp b/modules/juce_graphics/native/juce_Direct2DGraphicsContext_windows.cpp index 841f5d1f96..df66b54690 100644 --- a/modules/juce_graphics/native/juce_Direct2DGraphicsContext_windows.cpp +++ b/modules/juce_graphics/native/juce_Direct2DGraphicsContext_windows.cpp @@ -55,7 +55,7 @@ public: void push (ComSmartPtr context, const D2D1_LAYER_PARAMETERS& layerParameters) { // Clipping and transparency are all handled by pushing Direct2D - // layers.The SavedState creates an internal stack of Layer objects to + // layers. The SavedState creates an internal stack of Layer objects to // keep track of how many layers need to be popped. Pass nullptr for // the PushLayer layer parameter to allow Direct2D to manage the layers // (Windows 8 or later) @@ -105,7 +105,7 @@ public: Sink sink; geometry->Simplify (D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES, - D2D1::Matrix3x2F::Identity(), + layerParameters.maskTransform, 1.0f, &sink);