Bug 29125 - applying a clip can increase the region returned by cairo_copy_clip_rectangle_list
Summary: applying a clip can increase the region returned by cairo_copy_clip_rectangle...
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.9.13
Hardware: Other All
: medium normal
Assignee: Karl Tomlinson
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-16 18:09 UTC by Karl Tomlinson
Modified: 2010-07-17 03:32 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
consider gstate target extents in _cairo_gstate_copy_clip_rectangle_list (5.03 KB, patch)
2010-07-16 18:15 UTC, Karl Tomlinson
Details | Splinter Review

Description Karl Tomlinson 2010-07-16 18:09:55 UTC
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).
Comment 1 Karl Tomlinson 2010-07-16 18:15:22 UTC
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.
Comment 2 Chris Wilson 2010-07-17 03:32:52 UTC
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.