[cairo-bugs] [Bug 21111] New: Pattern surfaces don't work with xlib surfaces

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Apr 10 08:10:33 PDT 2009


           Summary: Pattern surfaces don't work with xlib surfaces
           Product: cairo
           Version: 1.8.0
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: xlib backend
        AssignedTo: cworth at cworth.org
        ReportedBy: muks at banu.com
         QAContact: cairo-bugs at cairographics.org

The following code creates 'pcontext' which is made to hold a tiling pattern,
and then uses it to fill 'context' whose surface is a GtkDrawingArea. But
'pcontext' appears nowhere on 'context'.

        cairo_t *context;
        cairo_surface_t *surface;
        cairo_t *pcontext;

        context = gdk_cairo_create (GDK_DRAWABLE (window));

        surface = cairo_surface_create_similar
                (cairo_get_group_target (context),
                 CAIRO_CONTENT_COLOR_ALPHA, 4, 4);
        pcontext = cairo_create (surface);
        cairo_surface_destroy (surface);

        cairo_new_path (pcontext);
        cairo_set_source_rgba (pcontext, 1.0, 0.0, 0.0, 0.8);
        cairo_rectangle (pcontext, 1, 1, 2, 2);
        cairo_fill (pcontext);

        cairo_set_source_surface (context, cairo_get_target (pcontext),
                                  0, 0);
        cairo_pattern_set_extend (cairo_get_source (context),
        cairo_destroy (pcontext);

        cairo_move_to (context, 100.5, 100.5);
        cairo_line_to (context, 100.5, 600.5);
        cairo_line_to (context, 600.5, 600.5);
        cairo_line_to (context, 600.5, 550.5);
        cairo_line_to (context, 150.5, 550.5);
        cairo_line_to (context, 150.5, 100.5);
        cairo_line_to (context, 100.5, 100.5);
        cairo_fill (context);

        cairo_destroy (context);

On replacing cairo_surface_create_similar() with cairo_image_surface_create(),
this problem disappears. But using the xlib surface is preferable due to

FYI, I'm running this on a stock fully updated Fedora 10 x86_64 distro:


(--) PCI:*(0 at 1:0:0) ATI Technologies Inc Radeon Mobility X1400 rev 0,
Mem @ 0xd8000000/134217728, 0xee100000/65536, I/O @ 0x00002000/256,

(II) Loading /usr/lib64/xorg/modules/drivers//radeon_drv.so
(II) Module radeon: vendor="X.Org Foundation"
        compiled for 1.5.3, module version = 6.10.0
        Module class: X.Org Video Driver
        ABI class: X.Org Video Driver, version 4.1

Configure bugmail: http://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