[cairo] default rendering engine
Carl Worth
cworth at east.isi.edu
Fri Jun 4 07:31:19 PDT 2004
On Mon, 3 May 2004 13:08:39 -0700, Bill Spitzak wrote:
> Thanks for the info. I suspect now the problem is my Xserver:
>
> name of display: :0.0
> version number: 11.0
> vendor string: Mandrake Linux (XFree86 4.3, patch level 23mdk)
> vendor release number: 40300000
> XFree86 version: 4.3.0
>
> with the Nvidia driver.
>
> For me, this simple change of the cairo-demo/X11/cairo-demo will crash the X
> server immediatly when you resize the window:
The change you sent definitely does not crash my server (X.org version
6.7.0 with the ati driver).
But your patch also modifies the program significantly: It continually
translates the entire drawing on every expose, (since you're re-using
the same cairo_t without a save/restore pair). I wonder if the extreme
coordinates you get that way aren't tickling a bug somewhere. Try the
following patch which adds the missing save/restore to see if anything
is different.
-Carl
Index: cairo-demo.c
===================================================================
RCS file: /mirrors/freedesktop/cairo/cairo-demo/X11/cairo-demo.c,v
retrieving revision 1.8
diff -u -p -r1.8 cairo-demo.c
--- a/cairo-demo.c 11 May 2004 14:45:32 -0000 1.8
+++ b/cairo-demo.c 4 Jun 2004 14:24:56 -0000
@@ -218,7 +218,7 @@ win_draw(win_t *win)
{
#define NUM_DASH 2
static double dash[NUM_DASH] = {SIZE/4.0, SIZE/4.0};
- cairo_t *cr;
+ static cairo_t *cr = 0;
#ifndef CAIRO_HAS_XCB_SURFACE
Drawable drawable = win->win;
#else /* CAIRO_HAS_XCB_SURFACE */
@@ -232,12 +232,15 @@ win_draw(win_t *win)
XCBClearArea(win->dpy, 0, win->win, 0, 0, 0, 0);
#endif /* CAIRO_HAS_XCB_SURFACE */
+ if (!cr) {
cr = cairo_create();
#ifndef CAIRO_HAS_XCB_SURFACE
cairo_set_target_drawable (cr, win->dpy, drawable);
#else /* CAIRO_HAS_XCB_SURFACE */
cairo_set_target_xcb (cr, win->dpy, drawable, win->visual, 0);
#endif /* CAIRO_HAS_XCB_SURFACE */
+ }
+ cairo_save (cr);
cairo_set_rgb_color(cr, 1, 1, 1);
cairo_save(cr);
@@ -301,7 +304,8 @@ win_draw(win_t *win)
exit(0);
}
- cairo_destroy(cr);
+ cairo_restore (cr);
+ //cairo_destroy(cr);
}
#ifdef CAIRO_HAS_XCB_SURFACE
More information about the cairo
mailing list