Fixed layer management in Direct2D renderer.

ID2D1RenderTarget::PushAxisAlignedClip/PopAxisAlignedClip used to clip the region (with wxGraphicsRenderer::Clip) and ID2D1RenderTarget::PushLayer/PopLayer used to rendering to the transparent layer (with wxGraphicsRenderer::BeginLayer) are non independent but have to be used in the controlled sequences: "A PushAxisAlignedClip and PopAxisAlignedClip pair can occur around or within a PushLayer and PopLayer, but cannot overlap" (and of course finally each Push* call must have a matching Pop* call).
To control the sequence of access to the AxisAlignedClips and Layers there is implemented a wxStack data member holding Clips/Layers parameters which reflects a physical stack of respective Clips/Layers in ID2D1RenderTarget. This way we know in which order to pop and what to pop from ID2D1RenderTarget stack if there is a need to do so.

Closes #17590
This commit is contained in:
Artur Wieczorek
2016-07-05 21:21:18 +02:00
parent 6b7ae05e3f
commit 832db47346
3 changed files with 200 additions and 63 deletions

View File

@@ -451,12 +451,24 @@ public:
static wxGraphicsContext* Create();
/**
Clips drawings to the specified region.
Sets the clipping region to the intersection of the given region
and the previously set clipping region.
The clipping region is an area to which drawing is restricted.
@remarks
- Calling this function can only make the clipping region smaller,
never larger.
- You need to call ResetClip() first if you want to set the clipping
region exactly to the region specified.
- If resulting clipping region is empty, then all drawing upon the context
is clipped out (all changes made by drawing operations are masked out).
*/
virtual void Clip(const wxRegion& region) = 0;
/**
Clips drawings to the specified rectangle.
@overload
*/
virtual void Clip(wxDouble x, wxDouble y, wxDouble w, wxDouble h) = 0;