XSetState(_display, _gc, 0, 0, GXcopy, AllPlanes);
XFillRectangle(_display, _pixmap, _gc, 0, 0, _width, _height);
XFlush(_display);
+
+#ifdef CAIRO_SUPPORT
+ _cairo_surface = cairo_xlib_surface_create(_display, _pixmap, _visual, _width, _height);
+ cairo_xlib_surface_set_size(_cairo_surface, _width, _height);
+ _cairo_context = cairo_create(_cairo_surface);
+#endif
+
} else abort();
}
XUnmapWindow(_display, _window);
XDestroyWindow(_display, _window);
XCloseDisplay(_display);
+#ifdef CAIRO_SUPPORT
+ cairo_destroy(_cairo_context);
+ cairo_surface_destroy(_cairo_surface);
+#endif
}
int SimpleWindow::width() {
#ifdef CAIRO_SUPPORT
cairo_t *SimpleWindow::get_cairo_context_resource() {
- cairo_surface_t *surface;
-
- surface = cairo_xlib_surface_create(_display, _pixmap, _visual, _width, _height);
-
- cairo_xlib_surface_set_size(surface, _width, _height);
-
- return cairo_create(surface);
+ return _cairo_context;
}
#endif