[cairo-commit] 2 commits - src/cairo-scaled-font-subsets.c src/cairo-xlib-display.c src/cairo-xlib-private.h src/cairo-xlib-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Oct 18 11:22:18 PDT 2007


 src/cairo-scaled-font-subsets.c |   20 +++++++++-----------
 src/cairo-xlib-display.c        |    9 +++++++++
 src/cairo-xlib-private.h        |    1 +
 src/cairo-xlib-surface.c        |    9 +--------
 4 files changed, 20 insertions(+), 19 deletions(-)

New commits:
commit c64335a9a846ba18411a720f6e69e511b15e2c6b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Oct 17 23:12:49 2007 +0100

    [cairo-scaled-font-subsets] Simplify boolean return code.
    
    _cairo_sub_font_lookup_glyph() was returning either a NULL_POINTER
    error or success whereas its only caller was using it as a simple
    predicate and handled the 'error' rather than propagate it upwards.

diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index 320822b..35ba53c 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -275,7 +275,7 @@ _cairo_sub_font_pluck (void *entry, void *closure)
     _cairo_sub_font_destroy (sub_font);
 }
 
-static cairo_status_t
+static cairo_bool_t
 _cairo_sub_font_lookup_glyph (cairo_sub_font_t	                *sub_font,
                               unsigned long	                 scaled_font_glyph_index,
                               cairo_scaled_font_subsets_glyph_t *subset_glyph)
@@ -293,10 +293,10 @@ _cairo_sub_font_lookup_glyph (cairo_sub_font_t	                *sub_font,
         subset_glyph->is_composite = sub_font->is_composite;
         subset_glyph->x_advance = sub_font_glyph->x_advance;
 
-        return CAIRO_STATUS_SUCCESS;
+        return TRUE;
     }
 
-    return _cairo_error (CAIRO_STATUS_NULL_POINTER);
+    return FALSE;
 }
 
 static cairo_status_t
@@ -519,10 +519,9 @@ _cairo_scaled_font_subsets_map_glyph (cairo_scaled_font_subsets_t	*subsets,
         if (_cairo_hash_table_lookup (subsets->unscaled_sub_fonts, &key.base,
                                         (cairo_hash_entry_t **) &sub_font))
         {
-            status = _cairo_sub_font_lookup_glyph (sub_font,
-                                                   scaled_font_glyph_index,
-                                                   subset_glyph);
-            if (status == CAIRO_STATUS_SUCCESS)
+            if (_cairo_sub_font_lookup_glyph (sub_font,
+                                              scaled_font_glyph_index,
+                                              subset_glyph))
                 return CAIRO_STATUS_SUCCESS;
         }
     }
@@ -533,10 +532,9 @@ _cairo_scaled_font_subsets_map_glyph (cairo_scaled_font_subsets_t	*subsets,
     if (_cairo_hash_table_lookup (subsets->scaled_sub_fonts, &key.base,
                                   (cairo_hash_entry_t **) &sub_font))
     {
-        status = _cairo_sub_font_lookup_glyph (sub_font,
-                                               scaled_font_glyph_index,
-                                               subset_glyph);
-        if (status == CAIRO_STATUS_SUCCESS)
+        if (_cairo_sub_font_lookup_glyph (sub_font,
+                                          scaled_font_glyph_index,
+                                          subset_glyph))
             return CAIRO_STATUS_SUCCESS;
     }
 
commit 379b9b79fa77be1bf9b5e0581b2363e80b0a8c88
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Oct 17 20:41:57 2007 +0100

    [cairo-xlib] Move the buggy_repeat discovery to the display_t.
    
    The VendorString parsing (to detect broken Xserver versions) was being
    performed for each surface creation, but as it is a display invariant
    we can save a small amount of work by storing the result on the
    cairo_xlib_display_t.

diff --git a/src/cairo-xlib-display.c b/src/cairo-xlib-display.c
index d77b64f..efb53ba 100644
--- a/src/cairo-xlib-display.c
+++ b/src/cairo-xlib-display.c
@@ -290,6 +290,15 @@ _cairo_xlib_display_get (Display *dpy)
     display->close_display_hooks = NULL;
     display->closed = FALSE;
 
+    display->buggy_repeat = FALSE;
+    if (strstr (ServerVendor (dpy), "X.Org") != NULL) {
+	if (VendorRelease (dpy) <= 60802000)
+	    display->buggy_repeat = TRUE;
+    } else if (strstr (ServerVendor (dpy), "XFree86") != NULL) {
+	if (VendorRelease (dpy) <= 40500000)
+	    display->buggy_repeat = TRUE;
+    }
+
     display->next = _cairo_xlib_display_list;
     _cairo_xlib_display_list = display;
 
diff --git a/src/cairo-xlib-private.h b/src/cairo-xlib-private.h
index ce2e5ae..05c7d0e 100644
--- a/src/cairo-xlib-private.h
+++ b/src/cairo-xlib-private.h
@@ -70,6 +70,7 @@ struct _cairo_xlib_display {
 
     cairo_freelist_t hook_freelist;
     cairo_xlib_hook_t *close_display_hooks;
+    unsigned int buggy_repeat :1;
     unsigned int closed :1;
 };
 
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index f44ed4b..56cf0e4 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -2012,14 +2012,7 @@ _cairo_xlib_surface_create_internal (Display		       *dpy,
     surface->width = width;
     surface->height = height;
 
-    surface->buggy_repeat = FALSE;
-    if (strstr (ServerVendor (dpy), "X.Org") != NULL) {
-	if (VendorRelease (dpy) <= 60802000)
-	    surface->buggy_repeat = TRUE;
-    } else if (strstr (ServerVendor (dpy), "XFree86") != NULL) {
-	if (VendorRelease (dpy) <= 40500000)
-	    surface->buggy_repeat = TRUE;
-    }
+    surface->buggy_repeat = screen_info->display->buggy_repeat;
 
     surface->dst_picture = None;
     surface->src_picture = None;


More information about the cairo-commit mailing list