Rendering bug when using operator "source" (ver. 1.12)

cu <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Dear developers,

Please take a look at the following rendering bug, that occurs when
using cairo operator "source" for drawing.
This is something that we've previously found as far back as version
1.9.8. The current incarnation has been tested and confirmed to exist in
1.12 release.

Attached is a sample source to replicate the problem. To see what the
expected output looks like, replace either operator "source" with "over"
or any one of non-integer values marked by comments with nearest integer
(i.e. 0.1 => 0)

Resolution would be greatly appreciated, as at this point we have to use
operator "over" instead, resulting in un-needed overhead.

--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
bug.c (text/plain, 1.1 KB)
#include <cairo.h>
#include <stdio.h>


int main()
{
   cairo_surface_t   *s2, *s1;
   cairo_pattern_t *p2;
   cairo_t  *cr;
   cairo_matrix_t    m2;

   s2 = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1000, 600);
   cr = cairo_create(s2);
   cairo_set_source_rgb(cr, 0, 1, 0);
   cairo_paint(cr);
   cairo_destroy(cr);

   s1 = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1000, 600);
   cr = cairo_create(s1);

   p2 = cairo_pattern_create_for_surface(s2);

   cairo_matrix_init_translate(&m2, 0, 0.1); // y offset must be non-integer
   cairo_pattern_set_matrix(p2, &m2);

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

   cairo_new_path(cr);
   cairo_move_to(cr, 10, 400.1); // one of y-dimensions must be non-integer
   cairo_line_to(cr, 990, 400.1);
   cairo_line_to(cr, 990, 600);
   cairo_line_to(cr, 10,  600);
   cairo_close_path(cr);

   cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); // operator must be "source"
   cairo_set_source(cr, p2);

   cairo_fill(cr);
   cairo_destroy(cr);

   cairo_surface_write_to_png(s1, "s1.png");
   cairo_surface_destroy(s1);
   cairo_surface_destroy(s2);
}
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.