[cairo] Bug in 1.12.4 and 1.12.6

ed44 ed44 at xs4all.nl
Wed Oct 31 09:14:36 PDT 2012


When stroking two or more curves and the path is clipped
the result is wrong in some cases.

Looks like the second curve is interpreted as a "line_to"

Increased linewith will decrease the error.

See test prog and png.

Test prog.:
-----------------------------------

#include <stdio.h>
#include <stdlib.h>
#include <cairo.h>

int
main(void)
{
     int x;

     cairo_surface_t *s=cairo_image_surface_create(CAIRO_FORMAT_RGB24, 
200, 200);
     cairo_t *cr=cairo_create(s);

     cairo_set_source_rgb(cr, 1, 1, 1);
     cairo_paint(cr);

     cairo_set_source_rgb(cr, 0, 0, 0);
     cairo_set_line_width(cr, 1.0);

     cairo_move_to(cr, 92.0,    163.0);
     cairo_curve_to(cr, 133.0,    163.0,
                     166.0,    132.0,
                     166.0,    96.0);
     cairo_curve_to(cr, 166.0,   58.0,
                            133.0,   27.0,
                      92.0,   27.0);
/*
     cairo_curve_to(cr, 52.0,   27.0,
                            19.0,   58.0,
                     19.0,    96.0);
     cairo_curve_to(cr,  19.0,    132.0,
                             52.0,    163.0,
                       92.0,    163.0);
     cairo_close_path(cr);
*/
     cairo_stroke(cr); /* result is OK */

     cairo_set_source_rgb(cr, 1, 0, 0);

        for(x=0; x < 190; x++){
         cairo_rectangle(cr, 0,x, 200,1);
         cairo_clip(cr);

         cairo_move_to(cr, 92.0,    163.0);
         cairo_curve_to(cr, 133.0,    163.0,
                     166.0,    132.0,
                     166.0,    96.0);
         cairo_curve_to(cr, 166.0,   58.0,
                            133.0,   27.0,
                      92.0,   27.0);
/*
         cairo_curve_to(cr, 52.0,   27.0,
                            19.0,   58.0,
                     19.0,    96.0);
         cairo_curve_to(cr,  19.0,    132.0,
                             52.0,    163.0,
                       92.0,    163.0);
         cairo_close_path(cr);
*/
         cairo_stroke(cr); /* result might be wrong */
         cairo_reset_clip(cr);
        }

      cairo_surface_write_to_png(s, "test.png");

     cairo_surface_destroy(s);
     cairo_destroy(cr);
     return 0;
}

---------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 3324 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20121031/aad7e223/attachment.png>


More information about the cairo mailing list