[cairo-commit] pycairo/cairo cairomodule.c, 1.18, 1.19 pycairo.h, 1.16, 1.17 pycairo-matrix.c, 1.8, 1.9 pycairo-private.h, 1.11, 1.12 pycairo-surface.c, 1.20, 1.21

Steve Chaplin commit at pdx.freedesktop.org
Tue Apr 12 06:19:43 PDT 2005


Committed by: stevech1097

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

Modified Files:
	cairomodule.c pycairo.h pycairo-matrix.c pycairo-private.h 
	pycairo-surface.c 
Log Message:
SC 2005/04/12

Index: cairomodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairomodule.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- cairomodule.c	10 Apr 2005 10:50:05 -0000	1.18
+++ cairomodule.c	12 Apr 2005 13:19:40 -0000	1.19
@@ -184,16 +184,11 @@
 
 static struct _PyCairo_FunctionStruct api = {
     pycairo_check_status,
-    &PyCairoMatrix_Type,
-    pycairo_matrix_wrap,
-    &PyCairoSurface_Type,
-    pycairo_surface_wrap,
-    &PyCairoFont_Type,
-    pycairo_font_wrap,
-    &PyCairoContext_Type,
-    pycairo_context_wrap,
-    &PyCairoPattern_Type,
-    pycairo_pattern_wrap,
+    &PyCairoMatrix_Type,   PyCairoMatrix_FromMatrix,
+    &PyCairoSurface_Type,  pycairo_surface_wrap,
+    &PyCairoFont_Type,     pycairo_font_wrap,
+    &PyCairoContext_Type,  pycairo_context_wrap,
+    &PyCairoPattern_Type,  pycairo_pattern_wrap,
 };
 
 DL_EXPORT(void)
@@ -221,7 +216,7 @@
     PyModule_AddObject(mod, "Matrix",  (PyObject *)&PyCairoMatrix_Type);
     PyModule_AddObject(mod, "Surface", (PyObject *)&PyCairoSurface_Type);
     PyModule_AddObject(mod, "Pattern", (PyObject *)&PyCairoPattern_Type);
-    PyModule_AddObject(mod, "Font", (PyObject *)&PyCairoFont_Type);
+    PyModule_AddObject(mod, "Font",    (PyObject *)&PyCairoFont_Type);
     PyModule_AddObject(mod, "Context", (PyObject *)&PyCairoContext_Type);
 
     PyModule_AddObject(mod, "_PyCairo_API",

Index: pycairo.h
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- pycairo.h	10 Apr 2005 10:50:05 -0000	1.16
+++ pycairo.h	12 Apr 2005 13:19:40 -0000	1.17
@@ -90,7 +90,7 @@
 
 #define pycairo_check_status (_PyCairo_API->check_status)
 #define PyCairoMatrix_Type  *(_PyCairo_API->matrix_type)
-#define pycairo_matrix_wrap  (_PyCairo_API->matrix_wrap)
+#define PyCairoMatrix_FromMatrix (_PyCairo_API->matrix_wrap)
 #define PyCairoSurface_Type *(_PyCairo_API->surface_type)
 #define pycairo_surface_wrap (_PyCairo_API->surface_wrap)
 #define PyCairoFont_Type    *(_PyCairo_API->font_type)

Index: pycairo-matrix.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-matrix.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- pycairo-matrix.c	8 Apr 2005 09:16:44 -0000	1.8
+++ pycairo-matrix.c	12 Apr 2005 13:19:40 -0000	1.9
@@ -37,25 +37,43 @@
 #include "pycairo-private.h"
 #include "pycairo-misc.h"
 
+
+/* PyCairoMatrix_FromMatrix
+ * Create a new PyCairoMatrix from a cairo_matrix_t
+ * Return value: New reference (NULL on failure)
+ *
+ * takes a copy of cairo_matrix_t
+ */
 PyObject *
-pycairo_matrix_wrap(cairo_matrix_t *matrix)
+PyCairoMatrix_FromMatrix(cairo_matrix_t *matrix)
 {
-    PyCairoMatrix *self;
-
-    self = PyObject_New(PyCairoMatrix, &PyCairoMatrix_Type);
-    if (self) {
-	self->matrix.xx = matrix->xx;
-	self->matrix.yx = matrix->yx;
-	self->matrix.xy = matrix->xy;
-	self->matrix.yy = matrix->yy;
-	self->matrix.x0 = matrix->x0;
-	self->matrix.y0 = matrix->y0;
+    PyCairoMatrix *m = (PyCairoMatrix *)PyCairoMatrix_Type.tp_new
+	(&PyCairoMatrix_Type, NULL, NULL);
+    if (m) {
+	m->matrix.xx = matrix->xx;
+	m->matrix.yx = matrix->yx;
+	m->matrix.xy = matrix->xy;
+	m->matrix.yy = matrix->yy;
+	m->matrix.x0 = matrix->x0;
+	m->matrix.y0 = matrix->y0;
     }
-    return (PyObject *)self;
+    return (PyObject *) m;
+}
+
+static void
+matrix_dealloc(PyCairoMatrix *m)
+{
+    m->ob_type->tp_free((PyObject *)m);
+}
+
+static PyObject *
+matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+    return type->tp_alloc(type, 0);
 }
 
 static int
-pycairo_matrix_init(PyCairoMatrix *self, PyObject *args, PyObject *kwargs)
+matrix_init(PyCairoMatrix *m, PyObject *args, PyObject *kwargs)
 {
     static char *kwlist[] = { "xx", "yx", "xy", "yy", "x0", "y0", NULL };
     double xx = 1.0, yx = 0.0, xy = 0.0, yy = 1.0, x0 = 0.0, y0 = 0.0;
@@ -65,40 +83,31 @@
 				     &xx, &yx, &xy, &yy, &x0, &y0))
 	return -1;
 
-    cairo_matrix_init(&self->matrix, xx, yx, xy, yy, x0, y0);
+    cairo_matrix_init(&m->matrix, xx, yx, xy, yy, x0, y0);
     return 0;
 }
 
-static void
-pycairo_matrix_dealloc(PyCairoMatrix *self)
-{
-    if (self->ob_type->tp_free)
-	self->ob_type->tp_free((PyObject *)self);
-    else
-	PyObject_Del(self);
-}
-
 static PyObject *
-pycairo_matrix_invert(PyCairoMatrix *self)
+matrix_invert(PyCairoMatrix *m)
 {
-    if (pycairo_check_status(cairo_matrix_invert(&self->matrix))) {
+    if (pycairo_check_status(cairo_matrix_invert(&m->matrix))) {
 	return NULL;
     }
     Py_RETURN_NONE;
 }
 
 static PyObject *
-pycairo_matrix_multiply(PyCairoMatrix *self, PyCairoMatrix *other)
+matrix_multiply(PyCairoMatrix *m, PyCairoMatrix *m2)
 {
     cairo_matrix_t result;
-    cairo_matrix_multiply(&result, &self->matrix, &other->matrix);
-    return pycairo_matrix_wrap(&result);
+    cairo_matrix_multiply(&result, &m->matrix, &m2->matrix);
+    return PyCairoMatrix_FromMatrix(&result);
 }
 
-static PyNumberMethods pycairo_matrix_as_number = {
+static PyNumberMethods matrix_as_number = {
   (binaryfunc)0,
   (binaryfunc)0,
-  (binaryfunc)pycairo_matrix_multiply,
+  (binaryfunc)matrix_multiply,
   (binaryfunc)0,
   (binaryfunc)0,
   (binaryfunc)0,
@@ -122,26 +131,26 @@
 };
 
 static PyObject *
-pycairo_matrix_repr(PyCairoMatrix *self)
+matrix_repr(PyCairoMatrix *m)
 {
     char buf[256];
 
     PyOS_snprintf(buf, sizeof(buf), "cairo.Matrix(%g, %g, %g, %g, %g, %g)",
-		  self->matrix.xx, self->matrix.yx, 
-		  self->matrix.xy, self->matrix.yy, 
-		  self->matrix.x0, self->matrix.y0);
+		  m->matrix.xx, m->matrix.yx, 
+		  m->matrix.xy, m->matrix.yy, 
+		  m->matrix.x0, m->matrix.y0);
     return PyString_FromString(buf);
 }
 
 static PyObject *
-pycairo_matrix_richcmp(PyCairoMatrix *self, PyCairoMatrix *other, int op)
+matrix_richcmp(PyCairoMatrix *m1, PyCairoMatrix *m2, int op)
 {
     int equal;
     PyObject *ret;
-    cairo_matrix_t *mx1 = &self->matrix;
-    cairo_matrix_t *mx2 = &other->matrix;
+    cairo_matrix_t *mx1 = &m1->matrix;
+    cairo_matrix_t *mx2 = &m2->matrix;
 
-    if (!PyObject_TypeCheck(other, &PyCairoMatrix_Type) ||
+    if (!PyObject_TypeCheck(m2, &PyCairoMatrix_Type) ||
 	!(op == Py_EQ || op == Py_NE)) {
 	Py_INCREF(Py_NotImplemented);
 	return Py_NotImplemented;
@@ -160,119 +169,119 @@
 }
 
 static PyObject *
-pycairo_matrix_rotate(PyCairoMatrix *self, PyObject *args)
+matrix_rotate(PyCairoMatrix *m, PyObject *args)
 {
     double radians;
 
     if (!PyArg_ParseTuple(args, "d:Matrix.rotate", &radians))
 	return NULL;
     
-    cairo_matrix_rotate(&self->matrix, radians);
+    cairo_matrix_rotate(&m->matrix, radians);
     Py_RETURN_NONE;
 }
 
 static PyObject *
-pycairo_matrix_scale(PyCairoMatrix *self, PyObject *args)
+matrix_scale(PyCairoMatrix *m, PyObject *args)
 {
     double sx, sy;
 
     if (!PyArg_ParseTuple(args, "dd:Matrix.scale", &sx, &sy))
 	return NULL;
     
-    cairo_matrix_scale(&self->matrix, sx, sy);
+    cairo_matrix_scale(&m->matrix, sx, sy);
     Py_RETURN_NONE;
 }
 
 static PyObject *
-pycairo_matrix_translate(PyCairoMatrix *self, PyObject *args)
+matrix_translate(PyCairoMatrix *m, PyObject *args)
 {
     double tx, ty;
 
     if (!PyArg_ParseTuple(args, "dd:Matrix.translate", &tx, &ty))
 	return NULL;
     
-    cairo_matrix_translate(&self->matrix, tx, ty);
+    cairo_matrix_translate(&m->matrix, tx, ty);
     Py_RETURN_NONE;
 }
 
 static PyObject *
-pycairo_matrix_transform_distance(PyCairoMatrix *self, PyObject *args)
+matrix_transform_distance(PyCairoMatrix *m, PyObject *args)
 {
     double dx, dy;
 
     if (!PyArg_ParseTuple(args, "dd:Matrix.transform_distance", &dx, &dy))
 	return NULL;
 
-    cairo_matrix_transform_distance(&self->matrix, &dx, &dy);
+    cairo_matrix_transform_distance(&m->matrix, &dx, &dy);
     return Py_BuildValue("(dd)", dx, dy);
 }
 
 static PyObject *
-pycairo_matrix_transform_point(PyCairoMatrix *self, PyObject *args)
+matrix_transform_point(PyCairoMatrix *m, PyObject *args)
 {
     double x, y;
 
     if (!PyArg_ParseTuple(args, "dd:Matrix.transform_point", &x, &y))
 	return NULL;
 
-    cairo_matrix_transform_point(&self->matrix, &x, &y);
+    cairo_matrix_transform_point(&m->matrix, &x, &y);
     return Py_BuildValue("(dd)", x, y);
 }
 
-static PyMethodDef pycairo_matrix_methods[] = {
-    { "invert",   (PyCFunction)pycairo_matrix_invert,     METH_NOARGS },
-    { "rotate",   (PyCFunction)pycairo_matrix_rotate,     METH_VARARGS },
-    { "scale",    (PyCFunction)pycairo_matrix_scale,      METH_VARARGS },
-    { "transform_distance", (PyCFunction)pycairo_matrix_transform_distance,
-      METH_VARARGS },
-    { "transform_point", (PyCFunction)pycairo_matrix_transform_point,
-      METH_VARARGS },
-    { "translate", (PyCFunction)pycairo_matrix_translate, METH_VARARGS },
+
+static PyMethodDef matrix_methods[] = {
+    { "invert",      (PyCFunction)matrix_invert,                METH_NOARGS },
+    { "rotate",      (PyCFunction)matrix_rotate,                METH_VARARGS },
+    { "scale",       (PyCFunction)matrix_scale,                 METH_VARARGS },
+    { "transform_distance",(PyCFunction)matrix_transform_distance,
+                                                                METH_VARARGS },
+    { "transform_point", (PyCFunction)matrix_transform_point,   METH_VARARGS },
+    { "translate",   (PyCFunction)matrix_translate,             METH_VARARGS },
     { NULL, NULL, 0 }
 };
 
+
 PyTypeObject PyCairoMatrix_Type = {
-    PyObject_HEAD_INIT(NULL)
+    PyObject_HEAD_INIT(&PyType_Type)
     0,                                  /* ob_size */
     "cairo.Matrix",                     /* tp_name */
     sizeof(PyCairoMatrix),              /* tp_basicsize */
     0,                                  /* tp_itemsize */
-    /* methods */
-    (destructor)pycairo_matrix_dealloc, /* tp_dealloc */
-    (printfunc)0,                       /* tp_print */
-    (getattrfunc)0,                     /* tp_getattr */
-    (setattrfunc)0,                     /* tp_setattr */
-    (cmpfunc)0,                         /* tp_compare */
-    (reprfunc)pycairo_matrix_repr,      /* tp_repr */
-    &pycairo_matrix_as_number,          /* tp_as_number */
+    (destructor)matrix_dealloc,         /* tp_dealloc */
+    0,                                  /* tp_print */
+    0,                                  /* tp_getattr */
+    0,                                  /* tp_setattr */
+    0,                                  /* tp_compare */
+    (reprfunc)matrix_repr,              /* tp_repr */
+    &matrix_as_number,                  /* tp_as_number */
     0,                                  /* tp_as_sequence */
     0,                                  /* tp_as_mapping */
-    (hashfunc)0,                        /* tp_hash */
-    (ternaryfunc)0,                     /* tp_call */
-    (reprfunc)0,                        /* tp_str */
-    (getattrofunc)0,                    /* tp_getattro */
-    (setattrofunc)0,                    /* tp_setattro */
+    0,                                  /* tp_hash */
+    0,                                  /* tp_call */
+    0,                                  /* tp_str */
+    0,                                  /* tp_getattro */
+    0,                                  /* tp_setattro */
     0,                                  /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT,                 /* tp_flags */
-    NULL,                               /* Documentation string */
-    (traverseproc)0,                    /* tp_traverse */
-    (inquiry)0,                         /* tp_clear */
-    (richcmpfunc)pycairo_matrix_richcmp,/* tp_richcompare */
+    NULL,                               /* tp_doc */
+    0,                                  /* tp_traverse */
+    0,                                  /* tp_clear */
+    (richcmpfunc)matrix_richcmp,        /* tp_richcompare */
     0,                                  /* tp_weaklistoffset */
-    (getiterfunc)0,                     /* tp_iter */
-    (iternextfunc)0,                    /* tp_iternext */
-    pycairo_matrix_methods,             /* tp_methods */
+    0,                                  /* tp_iter */
+    0,                                  /* tp_iternext */
+    matrix_methods,                     /* tp_methods */
     0,                                  /* tp_members */
     0,                                  /* tp_getset */
-    (PyTypeObject *)0,                  /* tp_base */
-    (PyObject *)0,                      /* tp_dict */
+    &PyBaseObject_Type,                 /* tp_base */
+    0,                                  /* tp_dict */
     0,                                  /* tp_descr_get */
     0,                                  /* tp_descr_set */
     0,                                  /* tp_dictoffset */
-    (initproc)pycairo_matrix_init,      /* tp_init */
-    (allocfunc)0,                       /* tp_alloc */
-    (newfunc)0,                         /* tp_new */
+    (initproc)matrix_init,              /* tp_init */
+    0,                                  /* tp_alloc */
+    (newfunc)matrix_new,                /* tp_new */
     0,                                  /* tp_free */
-    (inquiry)0,                         /* tp_is_gc */
-    (PyObject *)0,                      /* tp_bases */
+    0,                                  /* tp_is_gc */
+    0,                                  /* tp_bases */
 };

Index: pycairo-private.h
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-private.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- pycairo-private.h	10 Apr 2005 10:50:05 -0000	1.11
+++ pycairo-private.h	12 Apr 2005 13:19:40 -0000	1.12
@@ -53,7 +53,7 @@
 /* takes ownership of reference */
 PyObject *pycairo_context_wrap(cairo_t *ctx);
 PyObject *pycairo_font_wrap(cairo_font_face_t *font);
-PyObject *pycairo_matrix_wrap(cairo_matrix_t *matrix);
+PyObject *PyCairoMatrix_FromMatrix(cairo_matrix_t *matrix);
 PyObject *pycairo_pattern_wrap(cairo_pattern_t *pattern);
 PyObject *pycairo_surface_wrap(cairo_surface_t *surface, PyObject *base);
 

Index: pycairo-surface.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-surface.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- pycairo-surface.c	12 Apr 2005 02:41:23 -0000	1.20
+++ pycairo-surface.c	12 Apr 2005 13:19:40 -0000	1.21
@@ -51,32 +51,32 @@
 {
     // TODO - check base is actually a PyObject* or NULL
 
-    PyCairoSurface *self = PyObject_New(PyCairoSurface, &PyCairoSurface_Type);
-    if (self) {
-	self->surface = surface;
-	self->base = base;
+    PyCairoSurface *s = PyObject_New(PyCairoSurface, &PyCairoSurface_Type);
+    if (s) {
+	s->surface = surface;
+	s->base = base;
 	Py_XINCREF(base);
     }
-    return (PyObject *)self;
+    return (PyObject *)s;
 }
 
 static void
-surface_dealloc(PyCairoSurface *self)
+surface_dealloc(PyCairoSurface *s)
 {
 #ifdef DEBUG
     printf("surface_dealloc start\n");
 #endif
-    if (self->surface) {
-	cairo_surface_destroy(self->surface);
-	self->surface = NULL;
+    if (s->surface) {
+	cairo_surface_destroy(s->surface);
+	s->surface = NULL;
     }
 
-    Py_CLEAR(self->base);
+    Py_CLEAR(s->base);
 
-    if (self->ob_type->tp_free)
-	self->ob_type->tp_free((PyObject *)self);
+    if (s->ob_type->tp_free)
+	s->ob_type->tp_free((PyObject *)s);
     else
-	PyObject_Del(self);
+	PyObject_Del(s);
 #ifdef DEBUG
     printf("surface_dealloc end\n");
 #endif
@@ -85,7 +85,7 @@
 static PyObject *
 surface_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
-    PyCairoSurface *self;
+    PyCairoSurface *s;
     cairo_format_t format;
     int width, height;
 
@@ -93,23 +93,23 @@
 			  &format, &width, &height))
 	return NULL;
 
-    self = (PyCairoSurface *)type->tp_alloc(type, 0);
-    if (self){
-	self->surface = cairo_image_surface_create (format, width, height);
-	self->base = NULL;
-	if (!self->surface){
-	    Py_DECREF(self);
+    s = (PyCairoSurface *)type->tp_alloc(type, 0);
+    if (s) {
+	s->surface = cairo_image_surface_create (format, width, height);
+	s->base = NULL;
+	if (!s->surface){
+	    Py_DECREF(s);
 	    return PyErr_NoMemory();
 	}
     }
-    return (PyObject *)self;
+    return (PyObject *)s;
 }
 
 /* alternative constructor */
 static PyObject *
 surface_create_for_data(PyTypeObject *type, PyObject *args)
 {
-    PyCairoSurface *py_surface;
+    PyCairoSurface *s;
     char *data;
     cairo_format_t format;
     int length, width, height, stride = -1;
@@ -147,25 +147,25 @@
 	return NULL;
     }
 
-    py_surface = (PyCairoSurface *)type->tp_alloc(type, 0);
-    if (py_surface){
-	py_surface->surface = cairo_image_surface_create_for_data
+    s = (PyCairoSurface *)type->tp_alloc(type, 0);
+    if (s) {
+	s->surface = cairo_image_surface_create_for_data
 	    ((unsigned char *)data, format, width, height, stride);
-	py_surface->base = NULL;
-	if (!py_surface->surface) {
-	    Py_DECREF(py_surface);
+	s->base = NULL;
+	if (!s->surface) {
+	    Py_DECREF(s);
 	    return PyErr_NoMemory();
 	}
 	/* TODO get surface to hold reference to buffer ... */
     }
-    return (PyObject *)py_surface;
+    return (PyObject *)s;
 }
 
 /* alternative constructor */
 static PyObject *
 surface_create_for_png(PyTypeObject *type, PyObject *args)
 {
-    PyCairoSurface *py_surface;
+    PyCairoSurface *s;
     PyObject *file_object;
     int width, height;
 
@@ -173,19 +173,19 @@
 			  &PyFile_Type, &file_object))
 	return NULL;
 
-    py_surface = (PyCairoSurface *)type->tp_alloc(type, 0);
-    if (py_surface){
-	py_surface->surface = cairo_image_surface_create_for_png
+    s = (PyCairoSurface *)type->tp_alloc(type, 0);
+    if (s) {
+	s->surface = cairo_image_surface_create_for_png
 	    (PyFile_AsFile(file_object), &width, &height);
-	py_surface->base = NULL;
-	if (!py_surface->surface) {
-	    Py_DECREF(py_surface);
+	s->base = NULL;
+	if (!s->surface) {
+	    Py_DECREF(s);
 	    PyErr_SetString(PyExc_ValueError, "invalid PNG file or memory could not be allocated for operation");
 	    return NULL;
 	}
     }
-    return Py_BuildValue("O(ii)", py_surface, width, height);
-    /*return (PyObject *)py_surface;*/
+    return Py_BuildValue("O(ii)", s, width, height);
+    /*return (PyObject *)s;*/
 
     /* Py_BuildValue increments object ref count, which we don't want
      * proposed solution of returning object only (with getter for width,height) is better 
@@ -198,9 +198,9 @@
 }
 
 static PyObject *
-surface_create_similar(PyCairoSurface *self, PyObject *args)
+surface_create_similar(PyCairoSurface *s, PyObject *args)
 {
-    PyObject *py_surface;
+    PyObject *s2;
     cairo_surface_t *surface;
     cairo_format_t format;
     int width, height;
@@ -209,22 +209,22 @@
 			  &format, &width, &height))
 	return NULL;
 
-    surface = cairo_surface_create_similar(self->surface, format,
+    surface = cairo_surface_create_similar(s->surface, format,
 					   width, height);
     if (!surface)
 	return PyErr_NoMemory();
 
-    py_surface = pycairo_surface_wrap(surface, NULL);
-    if (!py_surface)
+    s2 = pycairo_surface_wrap(surface, NULL);
+    if (!s2)
 	cairo_surface_destroy(surface);
-    return py_surface;
+    return s2;
 }
 
 static PyObject *
-surface_finish(PyCairoSurface *self)
+surface_finish(PyCairoSurface *s)
 {
-    cairo_status_t status = cairo_surface_finish(self->surface);
-    Py_CLEAR(self->base);
+    cairo_status_t status = cairo_surface_finish(s->surface);
+    Py_CLEAR(s->base);
 
     if (pycairo_check_status(status))
 	return NULL;
@@ -235,25 +235,25 @@
 }
 
 static PyObject *
-surface_get_filter(PyCairoSurface *self)
+surface_get_filter(PyCairoSurface *s)
 {
-    return PyInt_FromLong(cairo_surface_get_filter(self->surface));
+    return PyInt_FromLong(cairo_surface_get_filter(s->surface));
 }
 
 static PyObject *
-surface_get_matrix(PyCairoSurface *self)
+surface_get_matrix(PyCairoSurface *s)
 {
     cairo_matrix_t matrix;
     cairo_status_t status;
 
-    status = cairo_surface_get_matrix(self->surface, &matrix);
+    status = cairo_surface_get_matrix(s->surface, &matrix);
     if (pycairo_check_status(status))
 	return NULL;
-    return pycairo_matrix_wrap(&matrix);
+    return PyCairoMatrix_FromMatrix(&matrix);
 }
 
 static PyObject *
-surface_set_device_offset(PyCairoSurface *self, PyObject *args)
+surface_set_device_offset(PyCairoSurface *s, PyObject *args)
 {
     double x_offset, y_offset;
 
@@ -261,12 +261,12 @@
 			  &x_offset, &y_offset))
 	return NULL;
 
-    cairo_surface_set_device_offset (self->surface, x_offset, y_offset);
+    cairo_surface_set_device_offset (s->surface, x_offset, y_offset);
     Py_RETURN_NONE;
 }
 
 static PyObject *
-surface_set_filter(PyCairoSurface *self, PyObject *args)
+surface_set_filter(PyCairoSurface *s, PyObject *args)
 {
     cairo_filter_t filter;
     cairo_status_t status;
@@ -274,14 +274,14 @@
     if (!PyArg_ParseTuple(args, "i:Surface.set_filter", &filter))
 	return NULL;
 
-    status = cairo_surface_set_filter(self->surface, filter);
+    status = cairo_surface_set_filter(s->surface, filter);
     if (pycairo_check_status(status))
 	return NULL;
     Py_RETURN_NONE;
 }
 
 static PyObject *
-surface_set_matrix(PyCairoSurface *self, PyObject *args)
+surface_set_matrix(PyCairoSurface *s, PyObject *args)
 {
     PyCairoMatrix *matrix;
 
@@ -289,12 +289,12 @@
 			  &PyCairoMatrix_Type, &matrix))
 	return NULL;
 
-    cairo_surface_set_matrix(self->surface, &matrix->matrix);
+    cairo_surface_set_matrix(s->surface, &matrix->matrix);
     Py_RETURN_NONE;
 }
 
 static PyObject *
-surface_set_repeat(PyCairoSurface *self, PyObject *args)
+surface_set_repeat(PyCairoSurface *s, PyObject *args)
 {
     int repeat;
     cairo_status_t status;
@@ -302,7 +302,7 @@
     if (!PyArg_ParseTuple(args, "i:Surface.set_repeat", &repeat))
 	return NULL;
 
-    status = cairo_surface_set_repeat(self->surface, repeat);
+    status = cairo_surface_set_repeat(s->surface, repeat);
     if (pycairo_check_status(status))
 	return NULL;
     Py_RETURN_NONE;
@@ -310,7 +310,7 @@
 
 #ifdef CAIRO_HAS_PNG_FUNCTIONS
 static PyObject *
-surface_write_png(PyCairoSurface *self, PyObject *args)
+surface_write_png(PyCairoSurface *s, PyObject *args)
 {
     PyObject *file_object;
     cairo_status_t status;
@@ -319,7 +319,7 @@
 			  &PyFile_Type, &file_object))
 	return NULL;
 
-    status = cairo_surface_write_png(self->surface, PyFile_AsFile(file_object));
+    status = cairo_surface_write_png(s->surface, PyFile_AsFile(file_object));
     if (pycairo_check_status(status))
 	return NULL;
     Py_RETURN_NONE;




More information about the cairo-commit mailing list