[cairo] Error with clipping when not antialiasing

Kristof Van Landschoot kristof at coin-c.com
Mon Apr 28 02:55:10 PDT 2008


Hi,

I've isolated what I think must be a bug in cairo with antialiasing.  In
this snippet of code I set an initial matrix, apply a clipping path, set a
new matrix and then draw a rectangle.  This rectangle is clipped away
entirely, however **only** when antialiasing is set to
CAIRO_ANTIALIAS_NONE.  If you comment out the line of code setting the
antialiasing the rectangle is (correctly) not clipped away.

This is using version 1.6.4 of cairo.

    cairo_surface_t *lSurface =
cairo_image_surface_create(CAIRO_FORMAT_ARGB32,3802,2146);
    unsigned char *lBuffer = cairo_image_surface_get_data(lSurface);
    memset(lBuffer,255,3802*2146*4);

    cairo_t *lStatus = cairo_create(lSurface);
    cairo_set_antialias(lStatus,CAIRO_ANTIALIAS_NONE);

    cairo_matrix_t lMatrix1;
    cairo_matrix_init(&lMatrix1,65.0304,0,0,65.0304,-5540,432.90443136);
    cairo_transform(lStatus,&lMatrix1);

    cairo_new_path(lStatus);
    cairo_rectangle(lStatus,85.1911,0.00168997,730.813,922.432);
    cairo_clip(lStatus);

    cairo_matrix_t lMatrix9;
    cairo_matrix_init(&lMatrix9,0.268657,0,0,0.268657,105.604903,0.985497);
    cairo_transform(lStatus,&lMatrix9);

    cairo_rectangle(lStatus,-0.23,0.5,103.67,65.3);
    cairo_set_source_rgba(lStatus,0,0,1,1);
    cairo_fill_preserve(lStatus);
    cairo_surface_flush(lSurface);

Thanks,
Best regards,
Kristof
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20080428/c6b57caf/attachment.htm 


More information about the cairo mailing list