Re: W32: Drawing globally-transparent stuff with cairo
LRN <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 30.03.2014 2:29, LRN wrote: > On 27.03.2014 19:54, LRN wrote: >> I've been trying to somehow hack GTK to have RGBA GdkWindows, >> with mixed results so far (i either get massive alpha corruption, >> or crash pixman inside bitblt). > >> Decided to take a step back and see if i can make it work 100% >> correctly with just GDI & cairo. Turns out, i can't. > >> I've attached an example, compile with gcc main.c -o main.exe >> -I/mingw/include/cairo -lcairo -lgdi32 -ldwmapi > >> It draws two gradients - one transparent, and one opaque. >> Transparency only works when window is invalidated and repainted >> (such as when it is obscured by another window and later shown >> again). > >> The problem is most likely W32-specific, and not directly related >> to cairo, but i simply can't find what is wrong :( > > > I'd like to thank everyone for the help. > > The problem was mostly in W32 display config (glass transparency > not enabled). > > I'm now convinced that the rest of my problems are due to a bug in > cairo/pixman. > > GTK bug tracking this is: > https://bugzilla.gnome.org/show_bug.cgi?id=727316 > > Traced inaccessible memory to _cairo_image_surface_map_to_image(), which gives pixman a pointer and claims that it points to image data of *width*, *height* with a *stride* - which turns out to be false. The patch that verifies that memory is accessible is attached. Backtrace is attached. - -- O< ascii ribbon - stop html email! - www.asciiribbon.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (MingW32) iQEcBAEBAgAGBQJTQSG1AAoJEOs4Jb6SI2CwvAEIALbZ8IFdq2T1x6CRoRd8IYCH XlLW4J9xxZGqwvuLFwkIVClRkAh4IoUPLzz5/nEgAUf4lJSzXQ2kTdq5qVOKBqwB CPlJlkNOScEfGSwRajJXXGvbj0S500Bnttw33iwqOv0B3+uuC8TjurGBDtq7nalr o9a1qIPV8m90QcMi/6qhvF8fN4Be35L8sJ1851weYhpOOj2xBpnIAhUvqSZ11cEY Z13PKpWyX+RVw4QHm2n4Ye6NBY0LEextt9ya942eNzjdB3fwV9LO66fkI9BMak5g XCmyfBwaTbOCMTebz3M6GzELS1wD6XiTZloXkSQSvVGfxdR/fw1JlhoHjNuxRVM= =GO+f -----END PGP SIGNATURE----- -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo
0023-check-data-accessibility.all.patch
(text/plain, 640 B)
--- cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/cairo-image-surface.c.orig 2014-03-21 13:10:19.000000000 +0000
+++ cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/cairo-image-surface.c 2014-04-06 09:37:15.850899100 +0000
@@ -809,10 +809,12 @@
cairo_image_surface_t *other = abstract_other;
cairo_surface_t *surface;
uint8_t *data;
+ uint8_t tmp;
data = other->data;
data += extents->y * other->stride;
data += extents->x * PIXMAN_FORMAT_BPP (other->pixman_format)/ 8;
+ tmp = data[other->stride * extents->height - 1];
surface =
_cairo_image_surface_create_with_pixman_format (data,
bt.log
(text/plain, 4.4 KB)
Program received signal SIGSEGV, Segmentation fault. 0x68dec6d0 in _cairo_image_surface_map_to_image (abstract_other=0x333a290, extents=0x28f4e0) at ../../cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/cairo-image-surface.c:817 817 tmp = data[other->stride * extents->height - 1]; (gdb) bt #0 0x68dec6d0 in _cairo_image_surface_map_to_image (abstract_other=0x333a290, extents=0x28f4e0) at ../../cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/cairo-image-surface.c:817 #1 0x68e29783 in _cairo_surface_map_to_image (surface=0x333a290, extents=0x28f4e0) at ../../cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/cairo-surface.c:644 #2 0x68e5da94 in _cairo_win32_display_surface_map_to_image (abstract_surface=0x333aa20, extents=0x28f4e0) at ../../cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/win32/cairo-win32-display-surface.c:478 #3 0x68e29783 in _cairo_surface_map_to_image (surface=0x333aa20, extents=0x28f4e0) at ../../cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/cairo-surface.c:644 #4 0x68ddbbd4 in _cairo_fallback_compositor_paint (_compositor=0x68ea8a08 <_cairo_fallback_compositor>, extents=0x28f498) at ../../cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/cairo-fallback-compositor.c:59 #5 0x68dd788d in _cairo_compositor_paint (compositor=0x68ea8a08 <_cairo_fallback_compositor>, surface=0x333aa20, op=CAIRO_OPERATOR_SOURCE, source=0x28f7d8, clip=0x3339ce8) at ../../cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/cairo-compositor.c:65 #6 0x68e5e3c1 in _cairo_win32_display_surface_paint (surface=0x333aa20, op=CAIRO_OPERATOR_SOURCE, source=0x28f7d8, clip=0x3339ce8) at ../../cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/win32/cairo-win32-display-surface.c:785 #7 0x68e2b10e in _cairo_surface_paint (surface=0x333aa20, op=CAIRO_OPERATOR_SOURCE, source=0x28f7d8, clip=0x3339ce8) at ../../cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/cairo-surface.c:2081 #8 0x68ddff8b in _cairo_gstate_paint (gstate=0x3337678) at ../../cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/cairo-gstate.c:1067 #9 0x68ddae34 in _cairo_default_context_paint (abstract_cr=0x3337658) at ../../cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/cairo-default-context.c:958 #10 0x68dd12cc in cairo_paint (cr=0x3337658) at ../../cairo-bb17403622e9ea474017e0039af8ee48b2b285db/src/cairo.c:2003 #11 0x70edd524 in gdk_window_end_paint (window=0x1d3e0b0) at ../../gtk+-3.12.0/gdk/gdkwindow.c:2864 #12 0x66552f6f in gtk_main_do_event (event=0x28fa50) at ../../gtk+-3.12.0/gtk/gtkmain.c:1648 #13 0x70ecac0f in _gdk_event_emit (event=event@entry=0x28fa50) at ../../gtk+-3.12.0/gdk/gdkevents.c:69 #14 0x70ed752c in _gdk_window_process_updates_recurse_helper (window=0x1d3e0b0, expose_region=<optimized out>, dx=<optimized out>, dy=0) at ../../gtk+-3.12.0/gdk/gdkwindow.c:3392 #15 0x70ed5958 in gdk_window_process_updates_internal (window=window@entry=0x1d3e0b0) at ../../gtk+-3.12.0/gdk/gdkwindow.c:3500 #16 0x70ed5a5b in gdk_window_process_updates_with_mode (window=<optimized out>, recurse_mode=<optimized out>) at ../../gtk+-3.12.0/gdk/gdkwindow.c:3697 #17 0x63a4637a in _g_closure_invoke_va (closure=0x1e0c3b8, return_value=0x0, instance=0x1d3e1f8, args=0x28fd18 "?AO\001x?3\003", n_params=0, param_types=0x0) at gclosure.c:831 #18 0x63a5eb8a in g_signal_emit_valist (instance=instance@entry=0x1d3e1f8, signal_id=signal_id@entry=153, detail=detail@entry=0, var_args=var_args@entry=0x28fd18 "?AO\001x?3\003") at gsignal.c:3215 #19 0x63a5fa7e in g_signal_emit_by_name (instance=0x1d3e1f8, detailed_signal=detailed_signal@entry=0x70f198f8 <__FUNCTION__.28014+264> "paint") at gsignal.c:3403 #20 0x70ecfb08 in gdk_frame_clock_paint_idle (data=0x1d3e1f8) at ../../gtk+-3.12.0/gdk/gdkframeclockidle.c:430 #21 0x70ec1595 in gdk_threads_dispatch (data=data@entry=0x1d8d340) at ../../gtk+-3.12.0/gdk/gdk.c:635 #22 0x685f2995 in g_timeout_dispatch (source=source@entry=0x3338c78, callback=0x70ec1550 <gdk_threads_dispatch>, user_data=0x1d8d340) at gmain.c:4473 #23 0x685f1dcf in g_main_dispatch (context=0x1d5b7c0) at gmain.c:3064 #24 g_main_context_dispatch (context=context@entry=0x1d5b7c0) at gmain.c:3663 #25 0x685f212b in g_main_context_iterate (context=<optimized out>, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3734 #26 0x685f2557 in g_main_loop_run (loop=0x3337f48) at gmain.c:3928 #27 0x6655218d in gtk_main () at ../../gtk+-3.12.0/gtk/gtkmain.c:1192 #28 0x0040286e in main (argc=1, argv=0x799f50) at ./main.c:20