Bug in 1.12.4 and 1.12.6

ed44 <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
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;
}

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

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
test.png (image/png, 3.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.