[cairo-commit] pycairo/cairo pycairo-context.c, 1.69, 1.70 pycairo-font.c, 1.30, 1.31 pycairo-pattern.c, 1.31, 1.32 pycairo-surface.c, 1.64, 1.65

Steve Chaplin commit at pdx.freedesktop.org
Sat Apr 29 00:26:10 PDT 2006


Committed by: stevech1097

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

Modified Files:
	pycairo-context.c pycairo-font.c pycairo-pattern.c 
	pycairo-surface.c 
Log Message:
'SC'

Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- pycairo-context.c	25 Apr 2006 02:45:59 -0000	1.69
+++ pycairo-context.c	29 Apr 2006 07:26:08 -0000	1.70
@@ -334,9 +334,9 @@
 static PyObject *
 pycairo_get_font_face (PycairoContext *o)
 {
-    cairo_font_face_t *font_face = cairo_get_font_face (o->ctx);
-    cairo_font_face_reference (font_face);
-    return PycairoFontFace_FromFontFace (font_face);
+    return PycairoFontFace_FromFontFace (
+               cairo_font_face_reference (
+		   cairo_get_font_face (o->ctx)));
 }
 
 static PyObject *

Index: pycairo-font.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-font.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- pycairo-font.c	4 Mar 2006 08:06:21 -0000	1.30
+++ pycairo-font.c	29 Apr 2006 07:26:08 -0000	1.31
@@ -92,8 +92,9 @@
 static PyMethodDef font_face_methods[] = {
      * methods never exposed in a language binding:
      * cairo_font_face_destroy()
-     * cairo_font_face_reference()
+     * cairo_font_face_get_type()
      * cairo_font_face_get_user_data()
+     * cairo_font_face_reference()
      * cairo_font_face_set_user_data(),
      *
     {NULL, NULL, 0, NULL},
@@ -231,13 +232,28 @@
 			  e.max_x_advance, e.max_y_advance);
 }
 
+static PyObject *
+scaled_font_get_font_face (PycairoScaledFont *o)
+{
+    return PycairoFontFace_FromFontFace (
+               cairo_font_face_reference (
+		   cairo_scaled_font_get_font_face (o->scaled_font)));
+}
+
 static PyMethodDef scaled_font_methods[] = {
     /* methods never exposed in a language binding:
      * cairo_scaled_font_destroy()
+     * cairo_scaled_font_get_type()
      * cairo_scaled_font_reference()
+     *
+     * TODO if requested:
+     * cairo_scaled_font_get_font_matrix
+     * cairo_scaled_font_get_ctm
+     * cairo_scaled_font_get_font_options
      */
+    {"extents",       (PyCFunction)scaled_font_extents, METH_NOARGS},
+    {"get_font_face", (PyCFunction)scaled_font_get_font_face, METH_NOARGS},
     /* glyph_extents - undocumented */
-    {"extents", (PyCFunction)scaled_font_extents, METH_NOARGS},
     {NULL, NULL, 0, NULL},
 };
 

Index: pycairo-pattern.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-pattern.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- pycairo-pattern.c	25 Apr 2006 02:45:59 -0000	1.31
+++ pycairo-pattern.c	29 Apr 2006 07:26:08 -0000	1.32
@@ -133,6 +133,7 @@
 static PyMethodDef pattern_methods[] = {
     /* methods never exposed in a language binding:
      * cairo_pattern_destroy()
+     * cairo_pattern_get_type()
      * cairo_pattern_reference()
      *
      * cairo_pattern_status()

Index: pycairo-surface.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-surface.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- pycairo-surface.c	25 Apr 2006 02:45:59 -0000	1.64
+++ pycairo-surface.c	29 Apr 2006 07:26:08 -0000	1.65
@@ -136,7 +136,6 @@
 static PyObject *
 surface_create_similar (PycairoSurface *o, PyObject *args)
 {
-    cairo_surface_t *surface;
     cairo_content_t content;
     int width, height;
 
@@ -144,9 +143,9 @@
 			   &content, &width, &height))
 	return NULL;
 
-    surface = cairo_surface_create_similar (o->surface, content,
-					    width, height);
-    return PycairoSurface_FromSurface (surface, NULL);
+    return PycairoSurface_FromSurface (
+	     cairo_surface_create_similar (o->surface, content, width, height),
+	     NULL);
 }
 
 static PyObject *
@@ -284,8 +283,9 @@
 static PyMethodDef surface_methods[] = {
     /* methods never exposed in a language binding:
      * cairo_surface_destroy()
-     * cairo_surface_reference()
+     * cairo_surface_get_type()
      * cairo_surface_get_user_data()
+     * cairo_surface_reference()
      * cairo_surface_set_user_data()
      */
     {"create_similar", (PyCFunction)surface_create_similar,    METH_VARARGS },
@@ -363,7 +363,7 @@
 	return NULL;
 
     o = type->tp_alloc(type, 0);
-    if (o) {
+    if (o != NULL) {
 	surface = cairo_image_surface_create (format, width, height);
 	if (Pycairo_Check_Status (cairo_surface_status (surface))) {
 	    cairo_surface_destroy (surface);
@@ -473,6 +473,8 @@
 	case CAIRO_FORMAT_A1:
 	    stride = (width + 1) / 8;
 	    break;
+	default:
+	    ASSERT_NOT_REACHED;
 	}
     }
     if (height * stride > buffer_len) {
@@ -717,7 +719,7 @@
 	return NULL;
 
     o = type->tp_alloc(type, 0);
-    if (o) {
+    if (o != NULL) {
 	surface = cairo_pdf_surface_create (filename, width_in_points,
 					    height_in_points);
 	if (Pycairo_Check_Status (cairo_surface_status (surface))) {
@@ -810,7 +812,7 @@
 	return NULL;
 
     o = type->tp_alloc(type, 0);
-    if (o) {
+    if (o != NULL) {
 	surface = cairo_ps_surface_create (filename, width_in_points,
 					   height_in_points);
 	if (Pycairo_Check_Status (cairo_surface_status (surface))) {
@@ -903,7 +905,7 @@
 	return NULL;
 
     o = type->tp_alloc(type, 0);
-    if (o) {
+    if (o != NULL) {
 	surface = cairo_svg_surface_create (filename, width_in_points,
 					    height_in_points);
 	if (Pycairo_Check_Status (cairo_surface_status (surface))) {
@@ -994,7 +996,7 @@
 	return NULL;
 
     o = type->tp_alloc(type, 0);
-    if (o) {
+    if (o != NULL) {
 	surface = cairo_win32_surface_create ((HDC)hdc);
 	if (Pycairo_Check_Status (cairo_surface_status (surface))) {
 	    cairo_surface_destroy (surface);



More information about the cairo-commit mailing list