cairo_copy_clip_rectangle_list(cairo_t*) returns the expected extents of the target surface until a clip is applied. When the clip is applied it is not intersected with the apparent existing clip (of the target extents) because there is no clip recorded on the context, and cairo_copy_clip_rectangle_list starts returning the applied clip (even when it is outside the target extents). This looks like a regression from http://cgit.freedesktop.org/cairo/commit/?id=bed2701e1c89095878d549cbca8f22d84f3dda3c where clips were disassociated from surfaces. Before that _cairo_clip_clip would consider the target extents. To be consistent with _cairo_gstate_clip_extents, the context's clip should be intersected with the target surface extents (instead of only using them when there is no clip).
Created attachment 37145 [details] [review] consider gstate target extents in _cairo_gstate_copy_clip_rectangle_list Intersecting the clip path with the target surface extents before getting the region seems better than trying to get a region and then intersecting with the target extents. With the later approach, some portion of the clip path beyond the target could prevent successful generation of the region (or at least cause unnecessary conversions to rectangles). I could have left a fast path for unbounded clips but went with the less-code approach. There was some inconsistency where lists with zero-rectangles were returned both for empty clips and unbounded clips. The tests expect zero rectangles for empty clips so unbounded clips (on infinite targets) now return CAIRO_STATUS_CLIP_NOT_REPRESENTABLE.
commit 108b1c7825116ed3f93aa57384bbd3290cdc9181 Author: Karl Tomlinson <karlt+@karlt.net> Date: Sat Jul 17 13:08:53 2010 +1200 clip: consider gstate target extents in _cairo_gstate_copy_clip_rectangle_list Fixes https://bugs.freedesktop.org/show_bug.cgi?id=29125 To be consistent with _cairo_gstate_clip_extents, the context's clip should be intersected with the target surface extents (instead of only using them when there is no clip). Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.