[cairo-commit] cairo/src cairo.c, 1.50, 1.51 cairo_gstate.c, 1.80, 1.81

Owen Taylor commit at pdx.freedesktop.org
Sun Feb 6 15:07:19 PST 2005


Committed by: otaylor

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv21038/src

Modified Files:
	cairo.c cairo_gstate.c 
Log Message:
2005-02-06  Owen Taylor  <otaylor at redhat.com>

        * src/cairo_gstate.c src/cairo.c: Allow cairo_set_font (cr, NULL)
        to unset the current font and return the cairo_t to the the
        "use the font from cairo_select_font() state".


Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- cairo.c	1 Feb 2005 23:06:36 -0000	1.50
+++ cairo.c	6 Feb 2005 23:07:17 -0000	1.51
@@ -1065,7 +1065,7 @@
 /**
  * cairo_set_font:
  * @cr: a #cairo_t
- * @font: a #cairo_font_t
+ * @font: a #cairo_font_t, or %NULL to unset any previously set font.
  * 
  * Replaces the current #cairo_font_t object in the #cairo_t with
  * @font. The replaced font in the #cairo_t will be destroyed if there

Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- cairo_gstate.c	3 Feb 2005 07:14:55 -0000	1.80
+++ cairo_gstate.c	6 Feb 2005 23:07:17 -0000	1.81
@@ -2315,10 +2315,13 @@
 _cairo_gstate_set_font (cairo_gstate_t *gstate, 
 			cairo_font_t   *font)
 {
-    if (gstate->font != NULL)    
-	cairo_font_destroy (gstate->font);
-    gstate->font = font;
-    cairo_font_reference (gstate->font);
+    if (font != gstate->font) {
+	if (gstate->font)
+	    cairo_font_destroy (gstate->font);
+	gstate->font = font;
+	if (gstate->font)
+	    cairo_font_reference (gstate->font);
+    }
     
     return CAIRO_STATUS_SUCCESS;
 }




More information about the cairo-commit mailing list