[cairo-commit] pycairo/cairo pycairo-context.c,1.10,1.11
Steve Chaplin
commit at pdx.freedesktop.org
Tue Nov 23 18:15:36 PST 2004
Committed by: stevech1097
Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv21874/cairo
Modified Files:
pycairo-context.c
Log Message:
SC 24/11/2004
Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- pycairo-context.c 15 Nov 2004 13:14:10 -0000 1.10
+++ pycairo-context.c 24 Nov 2004 02:15:34 -0000 1.11
@@ -6,7 +6,7 @@
#include "pycairo-private.h"
PyObject *
-pycairo_context_new(cairo_t *ctx)
+pycairo_context_wrap(cairo_t *ctx)
{
PyCairoContext *self;
@@ -21,26 +21,6 @@
return (PyObject *)self;
}
-static int
-pycairo_init(PyCairoContext *self, PyObject *args, PyObject *kwargs)
-{
- self->ctx = cairo_create();
- if (!self->ctx) {
- PyErr_SetString(PyExc_RuntimeError, "could not create context");
- return -1;
- }
-
- if (pycairo_check_status(cairo_status(self->ctx)))
- return -1;
-
- if (PyTuple_Size(args) != 0 || kwargs) {
- PyErr_SetString(PyExc_TypeError,"Context.__init__ takes no arguments");
- return -1;
- }
-
- return 0;
-}
-
static void
pycairo_dealloc(PyCairoContext *self)
{
@@ -55,6 +35,28 @@
}
static PyObject *
+pycairo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+ PyCairoContext *self = (PyCairoContext *)type->tp_alloc(type, 0);
+
+ if (self) {
+ self->ctx = cairo_create();
+ if (!self->ctx) {
+ PyErr_SetString(PyExc_RuntimeError, "could not create context");
+ Py_DECREF(self);
+ return NULL;
+ }
+ if (pycairo_check_status(cairo_status(self->ctx))) {
+ Py_DECREF(self);
+ return NULL;
+ }
+ }
+ return (PyObject *)self;
+}
+
+/* pycairo_init - not used */
+
+static PyObject *
pycairo_copy(PyCairoContext *self, PyObject *args)
{
PyCairoContext *src;
@@ -1283,9 +1285,9 @@
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
- (initproc)pycairo_init, /* tp_init */
+ (initproc)0, /* tp_init */
(allocfunc)0, /* tp_alloc */
- (newfunc)0, /* tp_new */
+ (newfunc)pycairo_new, /* tp_new */
0, /* tp_free */
(inquiry)0, /* tp_is_gc */
(PyObject *)0, /* tp_bases */
More information about the cairo-commit
mailing list