[cairo] [PATCH] Fix intersect_with_boxes() to produce tight clip extents

Uli Schlachter psychon at znc.in
Fri Jun 24 08:39:15 PDT 2011

On 21.06.2011 10:19, Taekyun Kim wrote:
> From: Taekyun Kim <tkq.kim at samsung.com>
> Previous code was intersecting extents with infinitely large rectangle.
> ---
>  src/cairo-clip.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> diff --git a/src/cairo-clip.c b/src/cairo-clip.c
> index a695cd7..e272d54 100644
> --- a/src/cairo-clip.c
> +++ b/src/cairo-clip.c
> @@ -1399,8 +1399,8 @@ intersect_with_boxes (cairo_composite_rectangles_t *extents,
>      cairo_rectangle_int_t rect;
>      cairo_box_t box;
> -    box.p1.x = box.p1.y = INT_MIN;
> -    box.p2.x = box.p2.y = INT_MAX;
> +    box.p1.x = box.p1.y = INT_MAX;
> +    box.p2.x = box.p2.y = INT_MIN;
>      while (num_boxes--) {
>  	if (boxes->p1.x < box.p1.x)
>  	    box.p1.x = boxes->p1.x;


This patch broke the xcb backend. It looks like it is clipping away too much,
because some of the resulting graphics are missing. Also, most of the tests that
broke are about clipping. I bisected with clip-disjoint clip-fill-eo-unbounded
trap-clip, see below.

clip-disjoint only looks broken on xcb-render-0.0. The other two tests broke on
all backends that I have enabled, except ps.

I don't have much time to investigate right now, but since even image is
affected, perhaps someone else can figure this out.


$ git bisect log
git bisect start
# bad: [77b6563c218dcff641820d2555ac93ad10a095e8] xcb: Use defines instead of
magic numbers
git bisect bad 77b6563c218dcff641820d2555ac93ad10a095e8
# good: [f409f74decf63b3dbf68b713317a1eb17cd71a0f] xlib: Fix build of xlib-xcb
git bisect good f409f74decf63b3dbf68b713317a1eb17cd71a0f
# good: [b6d593dc71e276576ce2af9fa2267eebdddd578a] build: Clean up environment
variables and flags for the win32 build
git bisect good b6d593dc71e276576ce2af9fa2267eebdddd578a
# bad: [5291f7ccad54b587bd1bee3a89426cf1d158c5bb] script-interpreter: Build on win32
git bisect bad 5291f7ccad54b587bd1bee3a89426cf1d158c5bb
# bad: [441f9c5037dd32464bd87e21108b702c0a3c508a] Fix intersect_with_boxes() to
produce tight clip extents
git bisect bad 441f9c5037dd32464bd87e21108b702c0a3c508a
# good: [8fb9a6727e2b769bfa388c6027ebad0a53ffa02b] boilerplate: Use correct flag
type in DFBWindowDescription
git bisect good 8fb9a6727e2b769bfa388c6027ebad0a53ffa02b

$ git bisect good
441f9c5037dd32464bd87e21108b702c0a3c508a is the first bad commit
commit 441f9c5037dd32464bd87e21108b702c0a3c508a
Author: Taekyun Kim <tkq.kim at samsung.com>
Date:   Tue Jun 21 17:19:58 2011 +0900

    Fix intersect_with_boxes() to produce tight clip extents

    Previous code was intersecting extents with infinitely large rectangle.

    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

:040000 040000 6c050d8078f84e94c5b14fbd8538e628dc7a394f
501f64c104551fd540d5487372e46d817a12c1a4 M	src

- Buck, when, exactly, did you lose your mind?
- Three months ago. I woke up one morning married to a pineapple.
  An ugly pineapple... But I loved her.

More information about the cairo mailing list