Skip to content

Commit

Permalink
Direct2D: Update assertion to check for alignment against screen rath…
Browse files Browse the repository at this point in the history
…er 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.
  • Loading branch information
reuk committed Jun 11, 2024
1 parent 4122427 commit 2a26439
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class PushedLayers
void push (ComSmartPtr<ID2D1DeviceContext1> 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)
Expand Down Expand Up @@ -105,7 +105,7 @@ class PushedLayers

Sink sink;
geometry->Simplify (D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES,
D2D1::Matrix3x2F::Identity(),
layerParameters.maskTransform,
1.0f,
&sink);

Expand Down

0 comments on commit 2a26439

Please sign in to comment.