[cairo] clipping bug

Carl Worth cworth at cworth.org
Wed Aug 24 02:45:21 PDT 2005


On Tue, 23 Aug 2005 21:13:41 +0200, Radek Doulík wrote:
> I am attaching patch for cairo/test directory with clip-all test which
> demonstrates that problem. Note that it enables X synchronization in
> cairo-test.c.

Thanks for the test case. That really makes bug reports much more
useful. To include this in cairo/test, could you send it again with
Copyright and licensing information?

> Perhaps someone who knows the clipping code can cook a quick fix.

When the size of the clip is zero, by definition no drawing operation
can have any effect. So it should be easy to bail out quite early in
this case.

Here's a patch that does make the test stop crashing, but I'm quite
sure this patch is not correct since it will probably break all
unbounded operators. (And even if the patch were correct, it's likely
only addressing one of a family of bugs).

-Carl

Index: src/cairo-surface.c
===================================================================
RCS file: /mirrors/freedesktop/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.99
diff -u -p -r1.99 cairo-surface.c
--- src/cairo-surface.c 24 Aug 2005 08:39:56 -0000      1.99
+++ src/cairo-surface.c 24 Aug 2005 09:36:40 -0000
@@ -1177,6 +1177,9 @@ _cairo_surface_composite_trapezoids (cai
     if (dst->finished)
        return CAIRO_STATUS_SURFACE_FINISHED;

+    if (width == 0 || height == 0)
+       return CAIRO_STATUS_SUCCESS;
+
     if (dst->backend->composite_trapezoids) {
        status = dst->backend->composite_trapezoids (operator,
                                                     pattern, dst,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050824/938c39f7/attachment-0001.pgp


More information about the cairo mailing list