Bug 9983

Summary: Cairo repeats image pattern in PDF output
Product: cairo Reporter: Mathias Hasselmann <mathias.hasselmann>
Component: pdf backendAssignee: Kristian Høgsberg <krh>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: blocker    
Priority: medium    
Version: 1.3.14   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Output of the PDF backend.
Output of the PS backend.
Primitive test image
Minimal test case
Correct output of the image backend for the testcase.
Correct output of the Postscript backend for the testcase.
Incorrect output of the PDF backend for the testcase.
Correct output showing things are working in 1.3.15

Description Mathias Hasselmann 2007-02-15 06:24:20 UTC
The PDF backend still has some problems with images used as pattern. The image and the PS backend render correctly.
Comment 1 Mathias Hasselmann 2007-02-15 06:25:09 UTC
Created attachment 8712 [details]
Output of the PDF backend.
Comment 2 Mathias Hasselmann 2007-02-15 06:25:41 UTC
Created attachment 8713 [details]
Output of the PS backend.
Comment 3 Mathias Hasselmann 2007-02-15 06:30:37 UTC
Forgot to mention how I render and how I create the pattern:

pattern creation:

            pixbuf_swap_red_and_blue(image->pixbuf);

            image->surface = cairo_image_surface_create_for_data(
                gdk_pixbuf_get_pixels(image->pixbuf), CAIRO_FORMAT_ARGB32,
                gdk_pixbuf_get_width(image->pixbuf), gdk_pixbuf_get_height(image->pixbuf),
                gdk_pixbuf_get_rowstride(image->pixbuf));

            image->pattern = cairo_pattern_create_for_surface(image->surface);
            cairo_pattern_set_extend(image->pattern, CAIRO_EXTEND_NONE);
            cairo_pattern_set_filter(image->pattern, CAIRO_FILTER_BEST);


rendering sequence for the image:

        cairo_save(cr);

        cairo_translate(cr, width/2, height/2);
        cairo_rotate(cr, M_PI * image->orientation/180);

        cairo_scale(cr, sx, sy);
        cairo_translate(cr, ix, iy);
        cairo_set_source(cr, image->pattern);

        if (image->opacity < 1.0) {
            cairo_paint_with_alpha(cr, image->opacity);
        } else {
            cairo_paint(cr);
        }

        cairo_restore(cr);
Comment 4 Mathias Hasselmann 2007-02-15 08:39:17 UTC
Created attachment 8721 [details]
Primitive test image
Comment 5 Mathias Hasselmann 2007-02-15 08:52:58 UTC
Created attachment 8723 [details]
Minimal test case
Comment 6 Mathias Hasselmann 2007-02-15 08:53:50 UTC
Created attachment 8724 [details]
Correct output of the image backend for the testcase.
Comment 7 Mathias Hasselmann 2007-02-15 08:54:26 UTC
Created attachment 8725 [details]
Correct output of the Postscript backend for the testcase.
Comment 8 Mathias Hasselmann 2007-02-15 08:55:00 UTC
Created attachment 8726 [details]
Incorrect output of the PDF backend for the testcase.
Comment 9 Behdad Esfahbod 2007-02-15 19:09:12 UTC
Carl, isn't this supposed to be fixed?
Comment 10 Carl Worth 2007-02-15 21:43:28 UTC
(In reply to comment #9)
> Carl, isn't this supposed to be fixed?

Yes, it was supposed to be---that's why I was surpised to find this bug here, (and very surprised because the bug report hadn't gotten mailed out to the cairo-bugs list when the bug was originally submitted).

I haven't looked closely at this yet to see what we missed.

-Carl
Comment 11 Mathias Hasselmann 2007-02-16 00:54:47 UTC
Reading in the release notes that this issue shall be fixed reminded me to check if I can deavivate abuse of the image backend in my code.
Comment 12 Carl Worth 2007-03-02 04:00:06 UTC
Created attachment 8947 [details]
Correct output showing things are working in 1.3.15

I just verified that yes, indeed, this bug is already fixed in the 1.3.15 series, (see newly attached output.pdf).

Thanks for the report,

-Carl
Comment 13 Carl Worth 2007-03-02 04:00:36 UTC
This is fixed in 1.3.15 already and the fix will of course be in 1.4.0.

-Carl

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.