[cairo-commit] pycairo/cairo pycairo-surface.c,1.10,1.11

Steve Chaplin commit at pdx.freedesktop.org
Sat Mar 19 09:23:48 PST 2005


Committed by: stevech1097

Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv23511/cairo

Modified Files:
	pycairo-surface.c 
Log Message:
SC 2005/03/19

Index: pycairo-surface.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-surface.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- pycairo-surface.c	18 Mar 2005 12:04:35 -0000	1.10
+++ pycairo-surface.c	19 Mar 2005 17:23:46 -0000	1.11
@@ -68,6 +68,37 @@
 }
 
 static PyObject *
+pycairo_surface_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+    PyCairoSurface *self = (PyCairoSurface *)type->tp_alloc(type, 0);
+
+    if (self)
+      self->surface = NULL;
+    return (PyObject *)self;
+}
+
+static int
+pycairo_surface_init(PyCairoSurface *self, PyObject *args, PyObject *kwargs)
+{
+    cairo_surface_t *surface;
+    cairo_format_t format;
+    int width, height;
+
+    if (!PyArg_ParseTuple(args, "iii:Surface.__init__",
+			  &format, &width, &height))
+	return -1;
+
+    surface = cairo_image_surface_create (format, width, height);
+    if (!surface){
+	PyErr_NoMemory();
+	return -1;
+    }
+    self->surface = surface;
+    return 0;
+}
+ 
+
+static PyObject *
 pycairo_surface_create_similar(PyCairoSurface *self, PyObject *args)
 {
     cairo_surface_t *surface;
@@ -220,9 +251,9 @@
     0,                                  /* tp_descr_get */
     0,                                  /* tp_descr_set */
     0,                                  /* tp_dictoffset */
-    (initproc)0,                        /* tp_init */
+    (initproc)pycairo_surface_init,     /* tp_init */
     (allocfunc)0,                       /* tp_alloc */
-    (newfunc)0,                         /* tp_new */
+    pycairo_surface_new,                /* tp_new */
     0,                                  /* tp_free */
     (inquiry)0,                         /* tp_is_gc */
     (PyObject *)0,                      /* tp_bases */




More information about the cairo-commit mailing list