[cairo-commit] pycairo/cairo pycairo-matrix.c,1.28,1.29

Steve Chaplin commit at pdx.freedesktop.org
Sat Dec 27 00:43:54 PST 2008


Committed by: stevech1097

Update of /cvs/cairo/pycairo/cairo
In directory kemper:/tmp/cvs-serv14470/cairo

Modified Files:
	pycairo-matrix.c 
Log Message:
'SC'

Index: pycairo-matrix.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-matrix.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- pycairo-matrix.c	10 Dec 2008 06:51:30 -0000	1.28
+++ pycairo-matrix.c	27 Dec 2008 08:43:51 -0000	1.29
@@ -99,11 +99,27 @@
     Py_RETURN_NONE;
 }
 
+/* cairo_matrix_multiply */
 static PyObject *
-matrix_multiply (PycairoMatrix *o, PycairoMatrix *o2)
+matrix_multiply (PycairoMatrix *o, PyObject *args)
 {
+    PycairoMatrix *mx2;
+
+    if (!PyArg_ParseTuple(args, "O!:Matrix.multiply",
+			  &PycairoMatrix_Type, &mx2))
+	return NULL;
+
     cairo_matrix_t result;
-    cairo_matrix_multiply (&result, &o->matrix, &o2->matrix);
+    cairo_matrix_multiply (&result, &o->matrix, &mx2->matrix);
+    return PycairoMatrix_FromMatrix (&result);
+}
+
+/* standard matrix multiply, for use by '*' operator */
+static PyObject *
+matrix_operator_multiply (PycairoMatrix *o, PycairoMatrix *o2)
+{
+    cairo_matrix_t result;
+    cairo_matrix_multiply (&result, &o2->matrix, &o->matrix);
     return PycairoMatrix_FromMatrix (&result);
 }
 
@@ -230,7 +246,7 @@
 static PyNumberMethods matrix_as_number = {
   (binaryfunc)0,   /*nb_add*/
   (binaryfunc)0,   /*nb_subtract*/
-  (binaryfunc)matrix_multiply, 	/*nb_multiply*/
+  (binaryfunc)matrix_operator_multiply,  /*nb_multiply*/
   (binaryfunc)0,   /*nb_divide*/
   (binaryfunc)0,   /*nb_remainder*/
   (binaryfunc)0,   /*nb_divmod*/
@@ -293,6 +309,7 @@
     {"init_rotate", (PyCFunction)matrix_init_rotate,
                                                    METH_VARARGS | METH_CLASS },
     {"invert",      (PyCFunction)matrix_invert,                METH_NOARGS },
+    {"multiply",    (PyCFunction)matrix_multiply,              METH_VARARGS },
     {"rotate",      (PyCFunction)matrix_rotate,                METH_VARARGS },
     {"scale",       (PyCFunction)matrix_scale,                 METH_VARARGS },
     {"transform_distance",(PyCFunction)matrix_transform_distance,



More information about the cairo-commit mailing list