Bug 4618 - BadMatch error when drawing gradient on rgba GtkWindow
Summary: BadMatch error when drawing gradient on rgba GtkWindow
Status: RESOLVED DUPLICATE of bug 10250
Alias: None
Product: cairo
Classification: Unclassified
Component: xlib backend (show other bugs)
Version: 1.0.3
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
Depends on:
Reported: 2005-09-28 01:33 UTC by Richard Stellingwerff
Modified: 2007-12-20 06:45 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

Simple GTK+ crash test. (1.66 KB, text/plain)
2005-09-28 01:34 UTC, Richard Stellingwerff

Description Richard Stellingwerff 2005-09-28 01:33:23 UTC
First off, I'm not sure if this bug is caused by cairo or GTK+. Hopefully
someone is able to tell after reading this report.

With GTK+ 2.8 it is possible to create a window with an RGBA colormap when using
the COMPOSITE extension plus a Compositor. This means that the window supports
per pixel alpha transparency.

I have discovered that drawing a linear gradient on such a surface (created with
gdk_cairo_create (widget->surface) will cause a "BadMatch" error. For some
reason this ONLY happens with patterns (tried only linear). It doesn't matter if
I use fill or stroke.

I have an older version of Xephyr as well in which the test app seems to work
just fine. Could it be that there's an extension missing for drawing gradients?

The backtrace I get is this:
Breakpoint 2, gdk_x_error (display=0xbfc38cb0, error=0xbfc38cb0) at
599       if (error->error_code)
(gdb) bt
#0  gdk_x_error (display=0xbfc38cb0, error=0xbfc38cb0) at gdkmain-x11.c:599
#1  0xb77fb733 in _XError () from /usr/lib/libX11.so.6
#2  0xb77f9d0b in _XReply () from /usr/lib/libX11.so.6
#3  0xb77f1965 in XSync () from /usr/lib/libX11.so.6
#4  0xb77f1a27 in XSync () from /usr/lib/libX11.so.6
#5  0xb77ea4f7 in XPutImage () from /usr/lib/libX11.so.6
#6  0xb7aa449e in _draw_image_surface (surface=0x807f790, image=0x8080a68,
dst_x=10, dst_y=10) at cairo-xlib-surface.c:700
#7  0xb7aa45a8 in _cairo_xlib_surface_release_dest_image
(abstract_surface=0x807f790, interest_rect=0xbfc39004, image=0x8080a68, 
    image_rect=0xbfc39010, image_extra=0x0) at cairo-xlib-surface.c:766
#8  0xb7a97276 in _cairo_surface_release_dest_image (surface=0x807f790,
interest_rect=0xbfc39004, image=0x8080a68, 
    image_rect=0xbfc39010, image_extra=0x0) at cairo-surface.c:661
#9  0xb7a97422 in _fallback_fini (state=0xbfc39000) at cairo-surface.c:771
#10 0xb7a974f5 in _fallback_composite (operator=CAIRO_OPERATOR_OVER,
src=0xbfc39290, mask=0x0, dst=0x807f790, src_x=10, src_y=10, 
    mask_x=10, mask_y=10, dst_x=10, dst_y=10, width=20, height=20) at
#11 0xb7a9764e in _cairo_surface_composite (operator=CAIRO_OPERATOR_OVER,
src=0xbfc39290, mask=0x0, dst=0x807f790, src_x=10, 
    src_y=10, mask_x=10, mask_y=10, dst_x=10, dst_y=10, width=20, height=20) at
#12 0xb7a8c11c in _composite_trap_region (clip=0x807f8fc, src=0xbfc39290,
operator=CAIRO_OPERATOR_OVER, dst=0x807f790, 
    trap_region=0x807fa80, extents=0xbfc39238) at cairo-gstate.c:1336
#13 0xb7a8c566 in _cairo_surface_clip_and_composite_trapezoids (src=0xbfc39290,
operator=CAIRO_OPERATOR_OVER, dst=0x807f790, 
    traps=0xbfc39350, clip=0x807f8fc, antialias=CAIRO_ANTIALIAS_DEFAULT) at
#14 0xb7a8c686 in _cairo_gstate_clip_and_composite_trapezoids (gstate=0x807f878,
traps=0xbfc39350) at cairo-gstate.c:1544
#15 0xb7a8c7b1 in _cairo_gstate_fill (gstate=0x807f878, path=0x807f848) at
#16 0xb7a86941 in *INT_cairo_fill_preserve (cr=0x807f840) at cairo.c:1598
#17 0xb7a86907 in cairo_fill (cr=0x807f840) at cairo.c:1576
#18 0x08048cb1 in on_alpha_window_expose ()
#19 0xb7d40374 in _gtk_marshal_BOOLEAN__BOXED (closure=0x80779a0,
return_value=0xbfc39510, n_param_values=2, 
    param_values=0xbfc39650, invocation_hint=0xbfc39538, marshal_data=0x0) at
#20 0xb7a51365 in IA__g_closure_invoke (closure=0x80779a0,
return_value=0xbfc38cb0, n_param_values=3217263792, 
    param_values=0xbfc38cb0, invocation_hint=0xbfc38cb0) at gclosure.c:490
#21 0xb7a6456f in signal_emit_unlocked_R (node=0x8066a90, detail=0,
instance=0x806bd98, emission_return=0xbfc395e0, 
    instance_and_params=0xbfc39650) at gsignal.c:2490
#22 0xb7a633d8 in IA__g_signal_emit_valist (instance=0x806bd98, signal_id=0,
    var_args=0xbfc397e0 "ø\227ÿ\200\230ÿ\b\230ÿtþä·ø\227ÿ") at gsignal.c:2259
#23 0xb7a63896 in IA__g_signal_emit (instance=0xbfc38cb0, signal_id=3217263792,
detail=3217263792) at gsignal.c:2293
#24 0xb7e50084 in gtk_widget_event_internal (widget=0x806bd98, event=0xbfc39880)
at gtkwidget.c:3735
#25 0xb7d3d47f in IA__gtk_main_do_event (event=0xbfc39880) at gtkmain.c:1355
#26 0xb7ba2c3e in gdk_window_process_updates_internal (window=0x80790b8) at
#27 0xb7ba2d8e in IA__gdk_window_process_all_updates () at gdkwindow.c:2268
#28 0xb7ba29f5 in gdk_window_update_idle (data=0x0) at gdkwindow.c:2136
#29 0xb79e6fc3 in g_idle_dispatch (source=0x807ee78, callback=0x80561a0,
user_data=0xbfc38cb0) at gmain.c:3813
#30 0xb79e3fc2 in g_main_dispatch (context=0x8062460) at gmain.c:1934
#31 0xb79e5038 in IA__g_main_context_dispatch (context=0x8062460) at gmain.c:2484
#32 0xb79e5370 in g_main_context_iterate (context=0x8062460, block=1,
dispatch=1, self=0x806fab0) at gmain.c:2565
#33 0xb79e5913 in IA__g_main_loop_run (loop=0x807ebb0) at gmain.c:2769
#34 0xb7d3cd43 in IA__gtk_main () at gtkmain.c:976
#35 0x08048e66 in main ()

Software used:
Xorg 6.8.2
Nvidia GLX 1.0.7174
Cairo CVS (Sept. 28, 1:04am CEST)
Metacity 2.10
xcompmgr CVS

If more details are needed, then let me know.
I'll attach the GTK+ crash app, but it requires the COMPOSITE extensions as well
as a Compositor (xcompmgr) running.
Comment 1 Richard Stellingwerff 2005-09-28 01:34:34 UTC
Created attachment 3418 [details]
Simple GTK+ crash test.
Comment 2 Richard Stellingwerff 2005-10-01 02:27:38 UTC
I've dug into the source of cairo, and I found that it fails with in
_draw_image_surce() at the follow function call:
    XPutImage(surface->dpy, surface->drawable, surface->gc,
          &ximage, 0, 0, dst_x, dst_y,
          image->width, image->height);

I'm not really sure why it fails. Probably incompatibilities in surface type
(xlib  backend not expecting a RGBA drawable?).

On a side note, setting an RGBA png file as a pattern and then paiting that
works without problems...
Comment 3 Chris Wilson 2007-12-20 06:45:32 UTC
Seems similar enough to be have been fixed by the same commit...

*** This bug has been marked as a duplicate of bug 10250 ***

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.