[cairo-commit] pycairo/cairo pycairo-surface.c, 1.73,
1.74 pycairo-pattern.c, 1.33, 1.34 pycairo-private.h, 1.38, 1.39
Steve Chaplin
commit at pdx.freedesktop.org
Sun Jun 11 00:17:28 PDT 2006
Committed by: stevech1097
Update of /cvs/cairo/pycairo/cairo
In directory kemper:/tmp/cvs-serv1013/cairo
Modified Files:
pycairo-surface.c pycairo-pattern.c pycairo-private.h
Log Message:
'SC'
Index: pycairo-surface.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-surface.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- pycairo-surface.c 28 May 2006 02:03:07 -0000 1.73
+++ pycairo-surface.c 11 Jun 2006 07:17:26 -0000 1.74
@@ -242,6 +242,18 @@
Py_RETURN_NONE;
}
+static PyObject *
+surface_set_fallback_resolution (PycairoSurface *o, PyObject *args)
+{
+ double x_ppi, y_ppi;
+
+ if (!PyArg_ParseTuple(args, "dd:Surface.set_fallback_resolution",
+ &x_ppi, &y_ppi))
+ return NULL;
+ cairo_surface_set_fallback_resolution (o->surface, x_ppi, y_ppi);
+ Py_RETURN_NONE;
+}
+
#ifdef CAIRO_HAS_PNG_FUNCTIONS
/* METH_O */
static PyObject *
@@ -291,6 +303,8 @@
{"mark_dirty", (PyCFunction)surface_mark_dirty, METH_KEYWORDS },
{"set_device_offset",(PyCFunction)surface_set_device_offset,
METH_VARARGS },
+ {"set_fallback_resolution",(PyCFunction)surface_set_fallback_resolution,
+ METH_VARARGS },
#ifdef CAIRO_HAS_PNG_FUNCTIONS
{"write_to_png", (PyCFunction)surface_write_to_png, METH_O },
#endif
@@ -459,7 +473,8 @@
stride = (width + 1) / 8;
break;
default:
- ASSERT_NOT_REACHED;
+ PyErr_SetString(CairoError, "Unknown format");
+ return NULL;
}
}
if (height * stride > buffer_len) {
@@ -707,34 +722,22 @@
cairo_pdf_surface_create (PyString_AsString(file),
width_in_points, height_in_points),
NULL);
-
- } else { /* file or file-like object argument */
- PyObject* writer = PyObject_GetAttrString (file, "write");
- if (writer == NULL || !PyCallable_Check (writer)) {
- Py_XDECREF(writer);
- PyErr_SetString(PyExc_TypeError,
+ }
+ /* file or file-like object argument */
+ PyObject* writer = PyObject_GetAttrString (file, "write");
+ if (writer == NULL || !PyCallable_Check (writer)) {
+ Py_XDECREF(writer);
+ PyErr_SetString(PyExc_TypeError,
"PDFSurface argument 1 must be a filename (str), file object, or an object "
"that has a \"write\" method (like StringIO)");
- return NULL;
- }
- Py_DECREF(writer);
-
- return PycairoSurface_FromSurface (
- cairo_pdf_surface_create_for_stream (_write_func,
- file, width_in_points, height_in_points),
- file);
+ return NULL;
}
-}
-
-static PyObject *
-pdf_surface_set_dpi (PycairoPDFSurface *o, PyObject *args)
-{
- double x_dpi, y_dpi;
+ Py_DECREF(writer);
- if (!PyArg_ParseTuple(args, "dd:PDFSurface.set_dpi", &x_dpi, &y_dpi))
- return NULL;
- cairo_pdf_surface_set_dpi (o->surface, x_dpi, y_dpi);
- Py_RETURN_NONE;
+ return PycairoSurface_FromSurface (
+ cairo_pdf_surface_create_for_stream (_write_func, file,
+ width_in_points, height_in_points),
+ file);
}
static PyObject *
@@ -751,7 +754,6 @@
}
static PyMethodDef pdf_surface_methods[] = {
- {"set_dpi", (PyCFunction)pdf_surface_set_dpi, METH_VARARGS },
{"set_size", (PyCFunction)pdf_surface_set_size, METH_VARARGS },
{NULL, NULL, 0, NULL},
};
@@ -824,22 +826,22 @@
width_in_points, height_in_points),
NULL);
- } else { /* file or file-like object argument */
- PyObject* writer = PyObject_GetAttrString (file, "write");
- if (writer == NULL || !PyCallable_Check (writer)) {
- Py_XDECREF(writer);
- PyErr_SetString(PyExc_TypeError,
+ }
+ /* else: file or file-like object argument */
+ PyObject* writer = PyObject_GetAttrString (file, "write");
+ if (writer == NULL || !PyCallable_Check (writer)) {
+ Py_XDECREF(writer);
+ PyErr_SetString(PyExc_TypeError,
"PSSurface argument 1 must be a filename (str), file object, or an object "
"that has a \"write\" method (like StringIO)");
- return NULL;
- }
- Py_DECREF(writer);
+ return NULL;
+ }
+ Py_DECREF(writer);
- return PycairoSurface_FromSurface (
- cairo_ps_surface_create_for_stream (_write_func,
- file, width_in_points, height_in_points),
+ return PycairoSurface_FromSurface (
+ cairo_ps_surface_create_for_stream (_write_func, file,
+ width_in_points, height_in_points),
file);
- }
}
static PyObject *
@@ -875,17 +877,6 @@
}
static PyObject *
-ps_surface_set_dpi (PycairoPSSurface *o, PyObject *args)
-{
- double x_dpi, y_dpi;
-
- if (!PyArg_ParseTuple(args, "dd:PSSurface.set_dpi", &x_dpi, &y_dpi))
- return NULL;
- cairo_ps_surface_set_dpi (o->surface, x_dpi, y_dpi);
- Py_RETURN_NONE;
-}
-
-static PyObject *
ps_surface_set_size (PycairoPSSurface *o, PyObject *args)
{
double width_in_points, height_in_points;
@@ -902,7 +893,6 @@
(PyCFunction)ps_surface_dsc_begin_page_setup, METH_NOARGS },
{"dsc_begin_setup", (PyCFunction)ps_surface_dsc_begin_setup, METH_NOARGS },
{"dsc_comment", (PyCFunction)ps_surface_dsc_comment, METH_VARARGS },
- {"set_dpi", (PyCFunction)ps_surface_set_dpi, METH_VARARGS },
{"set_size", (PyCFunction)ps_surface_set_size, METH_VARARGS },
{NULL, NULL, 0, NULL},
};
@@ -974,34 +964,22 @@
cairo_svg_surface_create (PyString_AsString(file),
width_in_points, height_in_points),
NULL);
-
- } else { /* file or file-like object argument */
- PyObject* writer = PyObject_GetAttrString (file, "write");
- if (writer == NULL || !PyCallable_Check (writer)) {
- Py_XDECREF(writer);
- PyErr_SetString(PyExc_TypeError,
+ }
+ /* else: file or file-like object argument */
+ PyObject* writer = PyObject_GetAttrString (file, "write");
+ if (writer == NULL || !PyCallable_Check (writer)) {
+ Py_XDECREF(writer);
+ PyErr_SetString(PyExc_TypeError,
"SVGSurface argument 1 must be a filename (str), file object, or an object "
"that has a \"write\" method (like StringIO)");
- return NULL;
- }
- Py_DECREF(writer);
-
- return PycairoSurface_FromSurface (
- cairo_svg_surface_create_for_stream (_write_func,
- file, width_in_points, height_in_points),
- file);
+ return NULL;
}
-}
-
-static PyObject *
-svg_surface_set_dpi (PycairoSVGSurface *o, PyObject *args)
-{
- double x_dpi, y_dpi;
+ Py_DECREF(writer);
- if (!PyArg_ParseTuple(args, "dd:SVGSurface.set_dpi", &x_dpi, &y_dpi))
- return NULL;
- cairo_svg_surface_set_dpi (o->surface, x_dpi, y_dpi);
- Py_RETURN_NONE;
+ return PycairoSurface_FromSurface (
+ cairo_svg_surface_create_for_stream (_write_func, file,
+ width_in_points, height_in_points),
+ file);
}
static PyMethodDef svg_surface_methods[] = {
@@ -1010,7 +988,6 @@
* cairo_svg_get_versions
* cairo_svg_version_to_string
*/
- {"set_dpi", (PyCFunction)svg_surface_set_dpi, METH_VARARGS },
{NULL, NULL, 0, NULL},
};
Index: pycairo-pattern.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-pattern.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- pycairo-pattern.c 29 May 2006 05:45:52 -0000 1.33
+++ pycairo-pattern.c 11 Jun 2006 07:17:26 -0000 1.34
@@ -73,7 +73,8 @@
type = &PycairoRadialGradient_Type;
break;
default:
- ASSERT_NOT_REACHED;
+ PyErr_SetString(CairoError, "Unsupported Pattern type");
+ return NULL;
}
o = type->tp_alloc(type, 0);
Index: pycairo-private.h
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-private.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- pycairo-private.h 1 May 2006 02:20:15 -0000 1.38
+++ pycairo-private.h 11 Jun 2006 07:17:26 -0000 1.39
@@ -116,10 +116,4 @@
} while (0)
#endif /* PY_MAJOR_VERSION */
-#define ASSERT_NOT_REACHED \
-do { \
- static const int NOT_REACHED = 0; \
- assert (NOT_REACHED); \
-} while (0)
-
#endif /* _PYCAIRO_PRIVATE_H_ */
More information about the cairo-commit
mailing list