Ian Britten
2009-05-06 16:12:33 UTC
Hi all,
[ wxGTK 2.8.9, GTK 2.12.9 ]
Can someone confirm that what I'm seeing is a bug in WX (or GTK),
and not my mis-understanding of how DC clipping with regions is
supposed to behave?
In my code, I dynamically build up a wxRegion to clip my graphics
against, using various criteria, and a series of
finalRegion.Intersect(currentRegion)
calls. No problems so far, and the results are as expected.
With this region built, I then set it on the DC before drawing:
wxDCClipper clip(theDC, finalRegion);
and in most cases, this works fine.
The problem seems to be the case when the finalRegion ends up
being IsEmpty(), due to the individual clip regions being disjoint
and there being no intersection between them.
In this workflow, I'd expect the DC to draw _nothing_, since I'm
only interested in seeing what satisfies the final region, and the
region is empty. What actually happens though is that *everything*
draws, as if the clip region was simply ignored by the DC.
I was able to add a workaround in my code to achieve my desired
effect, but I'm not sure if I should have to do this.
I worked around it by adding:
if (finalRegion.IsEmpty() == true)
finalRegion = wxRegion(-1, -1, 1, 1);
just before setting finalRegion on the DC, so the clip region is
a 1x1 pixel, just off the screen.
So, can anyone clarify whether this is a bug or intended?
Many thanks for any info!
Ian
[ wxGTK 2.8.9, GTK 2.12.9 ]
Can someone confirm that what I'm seeing is a bug in WX (or GTK),
and not my mis-understanding of how DC clipping with regions is
supposed to behave?
In my code, I dynamically build up a wxRegion to clip my graphics
against, using various criteria, and a series of
finalRegion.Intersect(currentRegion)
calls. No problems so far, and the results are as expected.
With this region built, I then set it on the DC before drawing:
wxDCClipper clip(theDC, finalRegion);
and in most cases, this works fine.
The problem seems to be the case when the finalRegion ends up
being IsEmpty(), due to the individual clip regions being disjoint
and there being no intersection between them.
In this workflow, I'd expect the DC to draw _nothing_, since I'm
only interested in seeing what satisfies the final region, and the
region is empty. What actually happens though is that *everything*
draws, as if the clip region was simply ignored by the DC.
I was able to add a workaround in my code to achieve my desired
effect, but I'm not sure if I should have to do this.
I worked around it by adding:
if (finalRegion.IsEmpty() == true)
finalRegion = wxRegion(-1, -1, 1, 1);
just before setting finalRegion on the DC, so the clip region is
a 1x1 pixel, just off the screen.
So, can anyone clarify whether this is a bug or intended?
Many thanks for any info!
Ian