[cairo-commit] 7 commits - configure.in src/cairo-os2-surface.c src/cairo-scaled-font.c src/cairo-user-font.c src/cairo-wideint-type-private.h src/cairo-xlib-surface.c src/check-def.sh

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed May 28 09:09:12 PDT 2008


 configure.in                     |    9 +++++----
 src/cairo-os2-surface.c          |    2 ++
 src/cairo-scaled-font.c          |   15 +++++++--------
 src/cairo-user-font.c            |    4 ++--
 src/cairo-wideint-type-private.h |   16 ++++++++++++++++
 src/cairo-xlib-surface.c         |    8 ++------
 src/check-def.sh                 |    8 +++++---
 7 files changed, 39 insertions(+), 23 deletions(-)

New commits:
commit f07407335503e5612dcf07cc8f44e1781367d263
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed May 28 12:01:38 2008 -0400

    [configure.in] Dont let a missing FcFini disable the freetype font backend!

diff --git a/configure.in b/configure.in
index b1a65f9..b3383a5 100644
--- a/configure.in
+++ b/configure.in
@@ -564,12 +564,13 @@ FREETYPE_MIN_VERSION=9.7.3
 
 CAIRO_BACKEND_ENABLE(ft, FreeType font, freetype, FT_FONT, auto, [
   ft_REQUIRES="fontconfig"
-  PKG_CHECK_MODULES(FONTCONFIG, $ft_REQUIRES,
-		    [_CHECK_FUNCS_WITH_FLAGS(FcFini, [$FONTCONFIG_CFLAGS], [$FONTCONFIG_LIBS],,
-		    [AC_MSG_RESULT(no); use_ft="no (requires fontconfig)"])],
+  PKG_CHECK_MODULES(FONTCONFIG, $ft_REQUIRES,,
 		    [AC_MSG_RESULT(no); use_ft="no (requires fontconfig)"])
 
   if test "x$use_ft" = "xyes"; then
+
+    _CHECK_FUNCS_WITH_FLAGS(FcFini, [$FONTCONFIG_CFLAGS], [$FONTCONFIG_LIBS])
+
     PKG_CHECK_MODULES(FREETYPE, freetype2 >= $FREETYPE_MIN_VERSION,
                       [freetype_pkgconfig=yes],
 		      [AC_MSG_RESULT(no)
diff --git a/src/cairo-os2-surface.c b/src/cairo-os2-surface.c
index 276398e..f485cfe 100644
--- a/src/cairo-os2-surface.c
+++ b/src/cairo-os2-surface.c
@@ -145,8 +145,10 @@ cairo_os2_fini (void)
     CAIRO_MUTEX_FINALIZE ();
 
 #if CAIRO_HAS_FT_FONT
+# if HAVE_FCFINI
     /* Uninitialize FontConfig */
     FcFini ();
+# endif
 #endif
 
 #ifdef __WATCOMC__
commit d7ddde8a324c5bfd9ca00d1fbb47cd3f1730bbfb
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed May 28 11:00:01 2008 -0400

    [cairo-user-font] Make backend struct static

diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c
index 75f0a75..887e37a 100644
--- a/src/cairo-user-font.c
+++ b/src/cairo-user-font.c
@@ -65,7 +65,7 @@ typedef struct _cairo_user_scaled_font {
 
 /* #cairo_user_scaled_font_t */
 
-const cairo_scaled_font_backend_t cairo_user_scaled_font_backend;
+static const cairo_scaled_font_backend_t cairo_user_scaled_font_backend;
 
 static cairo_int_status_t
 _cairo_user_scaled_glyph_init (void			 *abstract_font,
@@ -284,7 +284,7 @@ _cairo_user_text_to_glyphs (void           *abstract_font,
     return status;
 }
 
-const cairo_scaled_font_backend_t cairo_user_scaled_font_backend = {
+static const cairo_scaled_font_backend_t cairo_user_scaled_font_backend = {
     CAIRO_FONT_TYPE_USER,
     NULL,	/* create_toy */
     NULL,	/* scaled_font_fini */
commit 3306aa5e8d162f90c2ae957a9d72c42ac1ce62d9
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed May 28 10:59:35 2008 -0400

    [src/check-def.sh] Also check for public variables (#16129)

diff --git a/src/check-def.sh b/src/check-def.sh
index f399f7e..c400362 100755
--- a/src/check-def.sh
+++ b/src/check-def.sh
@@ -17,9 +17,9 @@ if tail -1 check-has-hidden-symbols.i | grep CAIRO_HAS_HIDDEN_SYMBOLS >/dev/null
 	exit 0
 fi
 
-get_cairo_syms='nm "$so" | grep " T " | cut -d" " -f3'
+get_cairo_syms='nm "$so" | grep " [BCDGINRSTVW] " | cut -d" " -f3'
 if [ "`uname -s`" = "Linux" ]; then
-       get_cairo_syms='objdump -t "$so" | sed -n "/.*g *F *\.\(opd\|text\).* \(.*cairo_.*\)$/s//\2/p"'
+       get_cairo_syms='objdump -t "$so" | grep "^[^ ]* [^l.*]*[.]" | sed "s/.* //"'
 fi
 
 defs="cairo.def"
commit f3a3a0594d457dcc7d11b794afe8408aee07a1ee
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed May 28 10:43:47 2008 -0400

    [cairo-xlib] Add recently-added byteswap macros (#16128)

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 662f4ad..c163c63 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -334,8 +334,7 @@ _swap_ximage_2bytes (XImage *ximage)
     for (j = ximage->height; j; j--) {
 	uint16_t *p = (uint16_t *)line;
 	for (i = ximage->width; i; i--) {
-	    *p = (((*p & 0x00ff) << 8) |
-		  ((*p)          >> 8));
+	    *p = bswap_16 (*p);
 	    p++;
 	}
 
@@ -352,10 +351,7 @@ _swap_ximage_4bytes (XImage *ximage)
     for (j = ximage->height; j; j--) {
 	uint32_t *p = (uint32_t *)line;
 	for (i = ximage->width; i; i--) {
-	    *p = (((*p & 0x000000ff) << 24) |
-		  ((*p & 0x0000ff00) << 8) |
-		  ((*p & 0x00ff0000) >> 8) |
-		  ((*p)              >> 24));
+	    *p = bswap_32 (*p);
 	    p++;
 	}
 
commit 0bf941c9b25503047be6d01b134f9fe2597423fd
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed May 28 10:43:22 2008 -0400

    Add support for byteswap macros bswap_16 and bswap_32

diff --git a/configure.in b/configure.in
index 2ec8f56..b1a65f9 100644
--- a/configure.in
+++ b/configure.in
@@ -745,7 +745,7 @@ CAIROPERF_LIBS=$RT_LIBS
 
 dnl ===========================================================================
 dnl Checks for misc headers
-AC_CHECK_HEADERS([libgen.h])
+AC_CHECK_HEADERS([libgen.h byteswap.h])
 
 dnl ===========================================================================
 dnl check compiler flags
diff --git a/src/cairo-wideint-type-private.h b/src/cairo-wideint-type-private.h
index 23e50df..aa76766 100644
--- a/src/cairo-wideint-type-private.h
+++ b/src/cairo-wideint-type-private.h
@@ -78,6 +78,22 @@
 #error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
 #endif
 
+#if HAVE_BYTESWAP_H
+# include <byteswap.h>
+#endif
+#ifndef bswap_16
+# define bswap_16(p) \
+	(((((uint16_t)(p)) & 0x00ff) << 8) | \
+	  (((uint16_t)(p))           >> 8));
+#endif
+#ifndef bswap_32
+# define bswap_32(p) \
+         (((((uint32_t)(p)) & 0x000000ff) << 24) | \
+	  ((((uint32_t)(p)) & 0x0000ff00) << 8)  | \
+	  ((((uint32_t)(p)) & 0x00ff0000) >> 8)  | \
+	  ((((uint32_t)(p)))              >> 24));
+#endif
+
 
 #if !HAVE_UINT64_T
 
commit 5c732badbc6148087cf99c906eb5f99c92ea0b92
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed May 28 09:00:13 2008 -0400

    [src/check-def.sh] Improve test comment

diff --git a/src/check-def.sh b/src/check-def.sh
index 3a45b32..f399f7e 100755
--- a/src/check-def.sh
+++ b/src/check-def.sh
@@ -29,8 +29,10 @@ for def in $defs; do
 	lib=`echo "$lib" | sed 's at .*/@@'`
 	so=.libs/lib${lib}.so
 
+	echo Checking that $so has the same symbol list as $def
+
+
 	test -f "$so" || continue
-	echo Checking $def
 
 	{
 		echo EXPORTS
commit e8dd97fde81a31c8875f03edbbcdb83da3830283
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue May 27 23:07:04 2008 -0400

    [cairo-scaled-font] Fix assertion failure
    
    Revert 127c4b8e643560c029818509e20fc5ca87408611
    We assume that all scaled fonts with ref count 0 are in holdover cache.
    That commit was breaking this assumption.

diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 7972598..0378f9b 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -932,6 +932,7 @@ void
 cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font)
 {
     cairo_scaled_font_t *lru = NULL;
+    cairo_scaled_font_map_t *font_map;
 
     if (scaled_font == NULL ||
 	    CAIRO_REFERENCE_COUNT_IS_INVALID (&scaled_font->ref_count))
@@ -939,16 +940,13 @@ cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font)
 
     assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&scaled_font->ref_count));
 
+    font_map = _cairo_scaled_font_map_lock ();
+    assert (font_map != NULL);
+
     if (_cairo_reference_count_dec_and_test (&scaled_font->ref_count)) {
-	cairo_scaled_font_map_t *font_map;
 
-	/* don't use _cairo_scaled_font_map_lock() to not create it if it's
-	 * NULL. if font_map is NULL, it means we are in the process of
-	 * destructing it.  don't err and continue */
-	CAIRO_MUTEX_LOCK (_cairo_scaled_font_map_mutex);
-	font_map = cairo_scaled_font_map;
 
-	if (!scaled_font->placeholder && font_map && scaled_font->hash_entry.hash != ZOMBIE) {
+	if (!scaled_font->placeholder && scaled_font->hash_entry.hash != ZOMBIE) {
 	    /* Rather than immediately destroying this object, we put it into
 	     * the font_map->holdovers array in case it will get used again
 	     * soon (and is why we must hold the lock over the atomic op on
@@ -974,9 +972,10 @@ cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font)
 	} else
 	    lru = scaled_font;
 
-	CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_map_mutex);
     }
 
+    CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_map_mutex);
+
     /* If we pulled an item from the holdovers array, (while the font
      * map lock was held, of course), then there is no way that anyone
      * else could have acquired a reference to it. So we can now


More information about the cairo-commit mailing list