[cairo] [PATCH 2/3] image: Proper handling of clip in _composite_boxes()

Taekyun Kim podain77 at gmail.com
Tue Jun 21 06:39:37 PDT 2011


2011/6/21 Chris Wilson <chris at chris-wilson.co.uk>

> On Tue, 21 Jun 2011 16:23:49 +0900, Taekyun Kim <podain77 at gmail.com>
> wrote:
> >
> > We cannot assume that given boxes are already clipped within clip
> > region even when clip_region contains single rectangle. So if we
> > have single rectangle clip_region, we have to manually clip boxes
> > within the clip rectangle so that we can make clip region to NULL.
>
> The boxes were meant to be clipped as they were constructed. That would
> appear to be the source of your bug.
> -Chris
>
> --
> Chris Wilson, Intel Open Source Technology Centre
>


As you mentioned, if boxes are properly clipped and clip can be
reduced to a region, everything is correct.

I tried some tests to detect cases where _cairo_clip_get_boxes() fails
but _cairo_clip_get_region() succeed. I've found such cases.

_cairo_clip_to_boxes() would return "extents" if clip cannot be reduced
to a set of boxes. In that case, our filling boxes might not be clipped.
So if _cairo_clip_get_boxes (inside of _cairo_clip_to_boxes) fails, we
cannot guarantee that boxes are clipped.

If what I understand is correct, region is a set of aligned rectangles and
boxes is a set of rectangles which do not need to be aligned. So if
_cairo_clip_get_region() succeed, _cairo_clip_get_boxes() should also
succeed. I think that is the source of this problem.

I'll go ahead and try to fix this.

-- 
Best Regards,
Taekyun Kim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110621/8c5f327c/attachment.htm>


More information about the cairo mailing list