[cairo-bugs] [Bug 51910] New: Surface based patterns are drawn incorrectly when using non-default pattern matrix

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jul 9 13:51:03 PDT 2012


https://bugs.freedesktop.org/show_bug.cgi?id=51910

             Bug #: 51910
           Summary: Surface based patterns are drawn incorrectly when
                    using non-default pattern matrix
    Classification: Unclassified
           Product: cairo
           Version: 1.12.2
          Platform: x86-64 (AMD64)
        OS/Version: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: xlib backend
        AssignedTo: cworth at cworth.org
        ReportedBy: thezbyg at gmail.com
         QAContact: cairo-bugs at cairographics.org


Created attachment 64019
  --> https://bugs.freedesktop.org/attachment.cgi?id=64019
Small program replicating the bug

Drawing surface based patterns breaks when using non-default pattern matrix in
Xlib backend. The same code works correctly in, at least, image backend. 

If you have a 32x32 px pattern image, then in the following code, first two
rectangles will have incorrect patterns.

pattern_surface = cairo_image_surface_create_from_png("pattern.png");
pattern = cairo_pattern_create_for_surface(pattern_surface);
cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
cairo_matrix_t matrix;
cairo_matrix_init_translate(&matrix, 14.1, 0);
cairo_pattern_set_matrix(pattern, &matrix);
cairo_set_source(cr, pattern);
for (int i = 0; i < 8; i++){
    cairo_rectangle(cr, i * 3.5, i * 32, 256, 32);
    cairo_fill(cr);
}

The same code works correctly when using image backend.

I attached a small program replicating this bug. This program shows the output
of Xlib backend in a window and saves the output of image backend into a file
test.png

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.


More information about the cairo-bugs mailing list