[cairo-commit] pycairo/cairo Makefile.am, 1.13,
1.14 cairogtkmodule.c, 1.21, 1.22
Steve Chaplin
commit at pdx.freedesktop.org
Sun May 15 18:04:39 PDT 2005
Committed by: stevech1097
Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv26253/cairo
Modified Files:
Makefile.am cairogtkmodule.c
Log Message:
SC
Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/Makefile.am,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- Makefile.am 14 May 2005 01:15:06 -0000 1.13
+++ Makefile.am 16 May 2005 01:04:34 -0000 1.14
@@ -39,5 +39,7 @@
svg_la_LDFLAGS = -module -avoid-version -export-symbols-regex initsvg
svg_la_LIBADD = $(CAIRO_LIBS) $(LIBSVG_CAIRO_LIBS)
svg_la_SOURCES = \
+ pycairosvg.h \
+ pycairosvg-private.h \
cairosvgmodule.c
endif
Index: cairogtkmodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairogtkmodule.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- cairogtkmodule.c 14 May 2005 01:26:31 -0000 1.21
+++ cairogtkmodule.c 16 May 2005 01:04:34 -0000 1.22
@@ -93,54 +93,57 @@
return py_surface;
}
-/* copied from gtk+/gdk/gdkdraw.c and gdkdrawable-x11.c
- * gdk_drawable_create_cairo_context() should be available in gtk 2.10
+/* copied from gtk+/gdk/gdkcairo.c and gtk+/gdk/x11/gdkdrawable-x11.c
+ * gdk_cairo_create() should be available in gtk 2.8
*/
static cairo_t *
-_gdk_drawable_create_cairo_context (GdkDrawable *drawable)
+_gdk_cairo_create (GdkDrawable *drawable)
{
cairo_t *cr = NULL;
cairo_surface_t *surface = NULL;
GdkVisual *visual = gdk_drawable_get_visual (drawable);
- if (GDK_IS_WINDOW (drawable))
- surface = cairo_xlib_surface_create_for_window_with_visual (GDK_WINDOW_XDISPLAY (drawable),
- GDK_WINDOW_XID (drawable),
- GDK_VISUAL_XVISUAL (visual));
- else if (visual)
- surface = cairo_xlib_surface_create_for_pixmap_with_visual (GDK_PIXMAP_XDISPLAY (drawable),
- GDK_PIXMAP_XID (drawable),
- GDK_VISUAL_XVISUAL (visual));
+ if (visual)
+ surface = cairo_xlib_surface_create_with_visual (GDK_DRAWABLE_XDISPLAY (drawable),
+ GDK_DRAWABLE_XID (drawable),
+ GDK_VISUAL_XVISUAL (visual));
else if (gdk_drawable_get_depth (drawable) == 1)
- surface = cairo_xlib_surface_create_for_pixmap (GDK_PIXMAP_XDISPLAY (drawable),
- GDK_PIXMAP_XID (drawable),
- CAIRO_FORMAT_A1);
- else
+ surface = cairo_xlib_surface_create (GDK_PIXMAP_XDISPLAY (drawable),
+ GDK_PIXMAP_XID (drawable),
+ CAIRO_FORMAT_A1);
+ else {
g_warning ("Using Cairo rendering requires the drawable argument to\n"
"have a specified colormap. All windows have a colormap,\n"
"however, pixmaps only have colormap by default if they\n"
"were created with a non-NULL window argument. Otherwise\n"
"a colormap must be set on them with gdk_drawable_set_colormap");
+ return NULL;
+ }
if (surface) {
+ if (GDK_IS_PIXMAP (drawable)) {
+ gint width, height;
+ gdk_drawable_get_size (drawable, &width, &height);
+ cairo_xlib_surface_set_size (surface, width, height);
+ }
cr = cairo_create (surface);
cairo_surface_destroy (surface);
}
return cr;
}
-/* gdk.Drawable.create_cairo_context() should be available in pygtk 2.10 */
+/* gdk.cairo_create() should be available in pygtk 2.8 */
static PyObject *
-create_cairo_context(PyObject *self, PyObject *args)
+gdk_cairo_create(PyObject *self, PyObject *args)
{
cairo_t *cr;
PyObject *c;
PyGObject *py_drawable;
- if (!PyArg_ParseTuple(args, "O!:create_cairo_context",
+ if (!PyArg_ParseTuple(args, "O!:gdk_cairo_create",
&PyGdkDrawable_Type, &py_drawable))
return NULL;
- cr = _gdk_drawable_create_cairo_context (GDK_DRAWABLE(py_drawable->obj));
+ cr = _gdk_cairo_create (GDK_DRAWABLE(py_drawable->obj));
if (!cr) {
PyErr_SetString(PyExc_RuntimeError, "could not create context");
return NULL;
@@ -154,10 +157,9 @@
static PyMethodDef cairogtk_functions[] = {
- { "create_cairo_context", (PyCFunction)create_cairo_context,
- METH_VARARGS },
+ { "gdk_cairo_create", (PyCFunction)gdk_cairo_create, METH_VARARGS },
{ "surface_create_for_pixbuf",
- (PyCFunction)surface_create_for_pixbuf, METH_VARARGS },
+ (PyCFunction)surface_create_for_pixbuf, METH_VARARGS },
{ NULL, NULL, 0 }
};
More information about the cairo-commit
mailing list