[cairo-commit] 6 commits - src/cairo.c src/cairo-compiler-private.h src/cairo-font-face.c src/cairo-hash.c src/cairoint.h src/cairo-path-in-fill.c src/cairo-pattern.c src/cairo-scaled-font.c src/cairo-type1-fallback.c test/in-fill-trapezoid.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Nov 13 03:39:16 PST 2008


 src/cairo-compiler-private.h |   17 +++
 src/cairo-font-face.c        |    2 
 src/cairo-hash.c             |  185 +++++++++++++++++++------------------------
 src/cairo-path-in-fill.c     |    2 
 src/cairo-pattern.c          |    1 
 src/cairo-scaled-font.c      |   11 +-
 src/cairo-type1-fallback.c   |    2 
 src/cairo.c                  |    3 
 src/cairoint.h               |   16 +--
 test/in-fill-trapezoid.c     |   34 +++++++
 10 files changed, 152 insertions(+), 121 deletions(-)

New commits:
commit 47a56e08501ec9375f75c15e35a68c77b313ada4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Sep 10 16:51:52 2008 +0100

    [type1] Bind the RD procedure
    
    As the RD procedure may be called several hundred times for a full font,
    it is worth binding.

diff --git a/src/cairo-type1-fallback.c b/src/cairo-type1-fallback.c
index 83ddc44..1f39a3f 100644
--- a/src/cairo-type1-fallback.c
+++ b/src/cairo-type1-fallback.c
@@ -590,7 +590,7 @@ cairo_type1_font_write_private_dict (cairo_type1_font_t *font,
     _cairo_output_stream_printf (encrypted_output,
                                  "    dup /Private 9 dict dup begin\n"
                                  "/RD {string currentfile exch readstring pop}"
-                                 " executeonly def\n"
+                                 " bind executeonly def\n"
                                  "/ND {noaccess def} executeonly def\n"
                                  "/NP {noaccess put} executeonly def\n"
                                  "/BlueValues [] def\n"
commit 0769d39d0093ec3bff5b72ecbfcef1bae2f03be2
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Nov 13 11:13:22 2008 +0000

    Add predicate likelihood macros.
    
    Define the couple of standard macros that we can use to guide gcc
    optimisations of which code path will be most likely taken.

diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h
index b93fd82..76b8e80 100644
--- a/src/cairo-compiler-private.h
+++ b/src/cairo-compiler-private.h
@@ -139,6 +139,23 @@
 #define cairo_const
 #endif
 
+#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
+#define _CAIRO_BOOLEAN_EXPR(expr)                   \
+ __extension__ ({                               \
+   int _cairo_boolean_var_;                         \
+   if (expr)                                    \
+      _cairo_boolean_var_ = 1;                      \
+   else                                         \
+      _cairo_boolean_var_ = 0;                      \
+   _cairo_boolean_var_;                             \
+})
+#define _cairo_likely(expr) (__builtin_expect (_CAIRO_BOOLEAN_EXPR(expr), 1))
+#define _cairo_unlikely(expr) (__builtin_expect (_CAIRO_BOOLEAN_EXPR(expr), 0))
+#else
+#define _cairo_likely(expr) (expr)
+#define _cairo_unlikely(expr) (expr)
+#endif
+
 #ifndef __GNUC__
 #undef __attribute__
 #define __attribute__(x)
commit b06c50cc54140a662adacde6336a3e7777f26ac3
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Nov 13 11:21:26 2008 +0000

    [cairoint.h] Remove unused PLT entries.
    
    Trim the slim_hidden_proto/def to match the currently used functions.

diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 9d476cd..610ba61 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -686,7 +686,6 @@ cairo_pattern_get_type (cairo_pattern_t *pattern)
 {
     return pattern->type;
 }
-slim_hidden_def (cairo_pattern_get_type);
 
 /**
  * cairo_pattern_status:
diff --git a/src/cairo.c b/src/cairo.c
index 2a9f746..56f99e4 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -414,7 +414,6 @@ cairo_push_group (cairo_t *cr)
 {
     cairo_push_group_with_content (cr, CAIRO_CONTENT_COLOR_ALPHA);
 }
-slim_hidden_def(cairo_push_group);
 
 /**
  * cairo_push_group_with_content:
@@ -597,7 +596,6 @@ cairo_pop_group_to_source (cairo_t *cr)
     cairo_set_source (cr, group_pattern);
     cairo_pattern_destroy (group_pattern);
 }
-slim_hidden_def(cairo_pop_group_to_source);
 
 /**
  * cairo_set_operator:
@@ -1918,7 +1916,6 @@ cairo_path_extents (cairo_t *cr,
     if (status)
 	_cairo_set_error (cr, status);
 }
-slim_hidden_def (cairo_path_extents);
 
 /**
  * cairo_paint:
diff --git a/src/cairoint.h b/src/cairoint.h
index fb8bf18..6101ea5 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -2458,6 +2458,7 @@ slim_hidden_proto (cairo_font_options_set_hint_metrics);
 slim_hidden_proto (cairo_font_options_set_hint_style);
 slim_hidden_proto (cairo_font_options_set_subpixel_order);
 slim_hidden_proto (cairo_font_options_status);
+slim_hidden_proto (cairo_format_stride_for_width);
 slim_hidden_proto (cairo_get_current_point);
 slim_hidden_proto (cairo_get_line_width);
 slim_hidden_proto (cairo_get_matrix);
@@ -2471,7 +2472,6 @@ slim_hidden_proto (cairo_image_surface_get_data);
 slim_hidden_proto (cairo_image_surface_get_height);
 slim_hidden_proto (cairo_image_surface_get_stride);
 slim_hidden_proto (cairo_image_surface_get_width);
-slim_hidden_proto (cairo_format_stride_for_width);
 slim_hidden_proto (cairo_line_to);
 slim_hidden_proto (cairo_mask);
 slim_hidden_proto (cairo_matrix_init);
@@ -2488,19 +2488,15 @@ slim_hidden_proto (cairo_matrix_translate);
 slim_hidden_proto (cairo_move_to);
 slim_hidden_proto (cairo_new_path);
 slim_hidden_proto (cairo_paint);
-slim_hidden_proto (cairo_path_extents);
 slim_hidden_proto (cairo_pattern_create_for_surface);
 slim_hidden_proto (cairo_pattern_create_rgb);
 slim_hidden_proto (cairo_pattern_create_rgba);
 slim_hidden_proto (cairo_pattern_destroy);
 slim_hidden_proto (cairo_pattern_get_extend);
-slim_hidden_proto (cairo_pattern_get_type);
 slim_hidden_proto_no_warn (cairo_pattern_reference);
 slim_hidden_proto (cairo_pattern_set_matrix);
 slim_hidden_proto (cairo_pattern_status);
 slim_hidden_proto (cairo_pop_group);
-slim_hidden_proto (cairo_pop_group_to_source);
-slim_hidden_proto (cairo_push_group);
 slim_hidden_proto (cairo_push_group_with_content);
 slim_hidden_proto (cairo_rel_line_to);
 slim_hidden_proto (cairo_restore);
@@ -2513,23 +2509,23 @@ slim_hidden_proto (cairo_scaled_font_get_ctm);
 slim_hidden_proto (cairo_scaled_font_get_font_face);
 slim_hidden_proto (cairo_scaled_font_get_font_matrix);
 slim_hidden_proto (cairo_scaled_font_get_font_options);
-slim_hidden_proto (cairo_scaled_font_text_to_glyphs);
 slim_hidden_proto (cairo_scaled_font_glyph_extents);
 slim_hidden_proto_no_warn (cairo_scaled_font_reference);
 slim_hidden_proto (cairo_scaled_font_status);
-slim_hidden_proto (cairo_set_font_size);
+slim_hidden_proto (cairo_scaled_font_text_to_glyphs);
 slim_hidden_proto (cairo_set_font_options);
+slim_hidden_proto (cairo_set_font_size);
 slim_hidden_proto (cairo_set_line_cap);
 slim_hidden_proto (cairo_set_line_join);
 slim_hidden_proto (cairo_set_line_width);
 slim_hidden_proto (cairo_set_matrix);
 slim_hidden_proto (cairo_set_operator);
 slim_hidden_proto (cairo_set_source);
-slim_hidden_proto (cairo_set_source);
 slim_hidden_proto (cairo_set_source_surface);
 slim_hidden_proto (cairo_status);
 slim_hidden_proto (cairo_stroke);
 slim_hidden_proto (cairo_stroke_preserve);
+slim_hidden_proto (cairo_surface_copy_page);
 slim_hidden_proto (cairo_surface_create_similar);
 slim_hidden_proto (cairo_surface_destroy);
 slim_hidden_proto (cairo_surface_finish);
@@ -2538,16 +2534,16 @@ slim_hidden_proto (cairo_surface_get_content);
 slim_hidden_proto (cairo_surface_get_device_offset);
 slim_hidden_proto (cairo_surface_get_font_options);
 slim_hidden_proto (cairo_surface_get_mime_data);
-slim_hidden_proto (cairo_surface_set_mime_data);
 slim_hidden_proto (cairo_surface_get_type);
 slim_hidden_proto (cairo_surface_has_show_text_glyphs);
 slim_hidden_proto (cairo_surface_mark_dirty_rectangle);
 slim_hidden_proto_no_warn (cairo_surface_reference);
 slim_hidden_proto (cairo_surface_set_device_offset);
 slim_hidden_proto (cairo_surface_set_fallback_resolution);
-slim_hidden_proto (cairo_surface_copy_page);
+slim_hidden_proto (cairo_surface_set_mime_data);
 slim_hidden_proto (cairo_surface_show_page);
 slim_hidden_proto (cairo_surface_status);
+slim_hidden_proto (cairo_surface_write_to_png_stream);
 slim_hidden_proto (cairo_text_cluster_allocate);
 slim_hidden_proto (cairo_text_cluster_free);
 slim_hidden_proto (cairo_toy_font_face_create);
commit 20fc2a2f92e27082a8806b9acb4b904dc84da672
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Nov 11 11:35:14 2008 +0000

    [in-fill] Fixup boundary insideness testing
    
    Benjamin Otte noticed that the top-left vertex was now included within the
    fill extents. Having updated the test case to check the insideness
    conditions as defined by flash, fix the edge handling to match.

diff --git a/src/cairo-path-in-fill.c b/src/cairo-path-in-fill.c
index f9920ea..fcac9b1 100644
--- a/src/cairo-path-in-fill.c
+++ b/src/cairo-path-in-fill.c
@@ -121,7 +121,7 @@ _cairo_in_fill_add_edge (cairo_in_fill_t *in_fill,
 	return;
 
     /* edge lies wholly to the right */
-    if (p1->x > in_fill->x && p2->x > in_fill->x)
+    if (p1->x >= in_fill->x && p2->x >= in_fill->x)
 	return;
 
     if ((p1->x <= in_fill->x && p2->x <= in_fill->x) ||
commit 9afad537301529a5a4b4ddf8b7e4425002ea39c7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Nov 11 10:22:17 2008 +0000

    [test] Expand in-fill-trapezoid
    
    Test vertices and edges of a rectangle to probe 'corner-cases', using the
    insideness conditions from flash.

diff --git a/test/in-fill-trapezoid.c b/test/in-fill-trapezoid.c
index 717a87a..5742968 100644
--- a/test/in-fill-trapezoid.c
+++ b/test/in-fill-trapezoid.c
@@ -42,6 +42,40 @@ draw (cairo_t *cr, int width, int height)
 	ret = CAIRO_TEST_FAILURE;
     }
 
+    /* rectangular boundary tests */
+    if (cairo_in_fill (cr, -10, -10)) {
+	cairo_test_log (ctx, "Error: Found top-left vertex inside rectangle\n");
+	ret = CAIRO_TEST_FAILURE;
+    }
+    if (cairo_in_fill (cr, -10, 10)) {
+	cairo_test_log (ctx, "Error: Found bottom-left vertex inside rectangle\n");
+	ret = CAIRO_TEST_FAILURE;
+    }
+    if (! cairo_in_fill (cr, 10, -10)) {
+	cairo_test_log (ctx, "Error: Failed to find top-right vertex inside rectangle\n");
+	ret = CAIRO_TEST_FAILURE;
+    }
+    if (cairo_in_fill (cr, 10, 10)) {
+	cairo_test_log (ctx, "Error: Found bottom-right vertex inside rectangle\n");
+	ret = CAIRO_TEST_FAILURE;
+    }
+    if (cairo_in_fill (cr, -10, 0)) {
+	cairo_test_log (ctx, "Error: Found left edge inside rectangle\n");
+	ret = CAIRO_TEST_FAILURE;
+    }
+    if (! cairo_in_fill (cr, 0, -10)) {
+	cairo_test_log (ctx, "Error: Failed to find top edge inside rectangle\n");
+	ret = CAIRO_TEST_FAILURE;
+    }
+    if (! cairo_in_fill (cr, 10, 0)) {
+	cairo_test_log (ctx, "Error: Failed to find right edge inside rectangle\n");
+	ret = CAIRO_TEST_FAILURE;
+    }
+    if (cairo_in_fill (cr, 0, 10)) {
+	cairo_test_log (ctx, "Error: Found bottom edge inside rectangle\n");
+	ret = CAIRO_TEST_FAILURE;
+    }
+
     /* simple circle */
     cairo_new_path (cr);
     cairo_arc (cr, 0, 0, 10, 0, 2 * M_PI);
commit cebc84f367a81eedebf7ab0b6b082691923c3ef7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Nov 8 00:06:38 2008 +0000

    [hash] Separate out unique patterns of iterating over the table.
    
    Avoid unnecessary conditionals for the hotpaths by separating out the
    iteration over the elements into their distinct modes.

diff --git a/src/cairo-font-face.c b/src/cairo-font-face.c
index f9a838a..eb4921e 100644
--- a/src/cairo-font-face.c
+++ b/src/cairo-font-face.c
@@ -511,7 +511,7 @@ cairo_toy_font_face_create (const char          *family,
 	}
 
 	/* remove the bad font from the hash table */
-	_cairo_hash_table_remove (hash_table, &key.base.hash_entry);
+	_cairo_hash_table_remove (hash_table, &font_face->base.hash_entry);
 	font_face->base.hash_entry.hash = 0;
     }
 
diff --git a/src/cairo-hash.c b/src/cairo-hash.c
index 5b2704f..78ea56b 100644
--- a/src/cairo-hash.c
+++ b/src/cairo-hash.c
@@ -108,7 +108,7 @@ static const cairo_hash_table_arrangement_t hash_table_arrangements [] = {
     { 4194304,		9227641,	9227639		},
     { 8388608,		18455029,	18455027	},
     { 16777216,		36911011,	36911009	},
-    { 33554432,		73819861,	73819859 	},
+    { 33554432,		73819861,	73819859	},
     { 67108864,		147639589,	147639587	},
     { 134217728,	295279081,	295279079	},
     { 268435456,	590559793,	590559791	}
@@ -205,85 +205,36 @@ _cairo_hash_table_destroy (cairo_hash_table_t *hash_table)
     free (hash_table);
 }
 
-/**
- * _cairo_hash_table_lookup_internal:
- *
- * @hash_table: a #cairo_hash_table_t to search
- * @key: the key to search on
- * @hash_code: the hash_code for @key
- * @key_unique: If %TRUE, then caller asserts that no key already
- * exists that will compare equal to #key, so search can be
- * optimized. If unsure, set to %FALSE and the code will always work.
- *
- * Search the hashtable for a live entry for which
- * hash_table->keys_equal returns true. If no such entry exists then
- * return the first available (free or dead entry).
- *
- * If the key_unique flag is set, then the search will never call
- * hash_table->keys_equal and will act as if it always returned
- * false. This is useful as a performance optimization in special
- * circumstances where the caller knows that there is no existing
- * entry in the hash table with a matching key.
- *
- * Return value: The matching entry in the hash table (if
- * any). Otherwise, the first available entry. The caller should check
- * entry->state to check whether a match was found or not.
- **/
 static cairo_hash_entry_t **
-_cairo_hash_table_lookup_internal (cairo_hash_table_t *hash_table,
-				   cairo_hash_entry_t *key,
-				   cairo_bool_t	       key_is_unique)
+_cairo_hash_table_lookup_unique_key (cairo_hash_table_t *hash_table,
+				     cairo_hash_entry_t *key)
 {
-    cairo_hash_entry_t **entry, **first_available = NULL;
     unsigned long table_size, i, idx, step;
+    cairo_hash_entry_t **entry;
 
     table_size = hash_table->arrangement->size;
-
     idx = key->hash % table_size;
-    step = 0;
 
-    for (i = 0; i < table_size; ++i)
-    {
-	entry = &hash_table->entries[idx];
-
-	if (ENTRY_IS_FREE(*entry))
-	{
-	    return entry;
-	}
-	else if (ENTRY_IS_DEAD(*entry))
-	{
-	    if (key_is_unique) {
-		return entry;
-	    } else {
-		if (! first_available)
-		    first_available = entry;
-	    }
-	}
-	else /* ENTRY_IS_LIVE(*entry) */
-	{
-	    if (! key_is_unique)
-		if (hash_table->keys_equal (key, *entry))
-		    return entry;
-	}
-
-	if (step == 0) {
-	    step = key->hash % hash_table->arrangement->rehash;
-	    if (step == 0)
-		step = 1;
-	}
+    entry = &hash_table->entries[idx];
+    if (! ENTRY_IS_LIVE (*entry))
+	return entry;
 
+    i = 1;
+    step = key->hash % hash_table->arrangement->rehash;
+    if (step == 0)
+	step = 1;
+    do {
 	idx += step;
 	if (idx >= table_size)
 	    idx -= table_size;
-    }
 
-    /*
-     * The table should not have permitted you to get here if you were just
-     * looking for a free slot: there should have been room.
-     */
-    assert (key_is_unique == 0);
+	entry = &hash_table->entries[idx];
+	if (! ENTRY_IS_LIVE (*entry))
+	    return entry;
+    } while (++i < table_size);
 
-    return first_available;
+    ASSERT_NOT_REACHED;
+    return NULL;
 }
 
 /**
@@ -298,10 +249,9 @@ _cairo_hash_table_lookup_internal (cairo_hash_table_t *hash_table,
  * %CAIRO_STATUS_NO_MEMORY if out of memory.
  **/
 static cairo_status_t
-_cairo_hash_table_resize  (cairo_hash_table_t *hash_table)
+_cairo_hash_table_resize (cairo_hash_table_t *hash_table)
 {
     cairo_hash_table_t tmp;
-    cairo_hash_entry_t **entry;
     unsigned long new_size, i;
 
     /* This keeps the hash table between 25% and 50% full. */
@@ -335,11 +285,8 @@ _cairo_hash_table_resize  (cairo_hash_table_t *hash_table)
 
     for (i = 0; i < hash_table->arrangement->size; ++i) {
 	if (ENTRY_IS_LIVE (hash_table->entries[i])) {
-	    entry = _cairo_hash_table_lookup_internal (&tmp,
-						       hash_table->entries[i],
-						       TRUE);
-	    assert (ENTRY_IS_FREE(*entry));
-	    *entry = hash_table->entries[i];
+	    *_cairo_hash_table_lookup_unique_key (&tmp, hash_table->entries[i])
+		= hash_table->entries[i];
 	}
     }
 
@@ -366,11 +313,34 @@ _cairo_hash_table_lookup (cairo_hash_table_t *hash_table,
 			  cairo_hash_entry_t *key)
 {
     cairo_hash_entry_t **entry;
+    unsigned long table_size, i, idx, step;
+
+    table_size = hash_table->arrangement->size;
+    idx = key->hash % table_size;
+    entry = &hash_table->entries[idx];
 
-    /* See if we have an entry in the table already. */
-    entry = _cairo_hash_table_lookup_internal (hash_table, key, FALSE);
-    if (ENTRY_IS_LIVE (*entry))
-	return *entry;
+    if (ENTRY_IS_LIVE (*entry)) {
+	if (hash_table->keys_equal (key, *entry))
+	    return *entry;
+    } else if (ENTRY_IS_FREE (*entry))
+	return NULL;
+
+    i = 1;
+    step = key->hash % hash_table->arrangement->rehash;
+    if (step == 0)
+	step = 1;
+    do {
+	idx += step;
+	if (idx >= table_size)
+	    idx -= table_size;
+
+	entry = &hash_table->entries[idx];
+	if (ENTRY_IS_LIVE (*entry)) {
+	    if (hash_table->keys_equal (key, *entry))
+		return *entry;
+	} else if (ENTRY_IS_FREE (*entry))
+	    return NULL;
+    } while (++i < table_size);
 
     return NULL;
 }
@@ -458,40 +428,61 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table,
 			  cairo_hash_entry_t *key_and_value)
 {
     cairo_status_t status;
-    cairo_hash_entry_t **entry;
 
     /* Insert is illegal while an iterator is running. */
     assert (hash_table->iterating == 0);
 
-    entry = _cairo_hash_table_lookup_internal (hash_table,
-					       key_and_value,
-					       TRUE);
-    /* _cairo_hash_table_lookup_internal with key_unique = TRUE
-     * aways returns an available entry. */
-    assert (! ENTRY_IS_LIVE(*entry));
-
-    *entry = key_and_value;
     hash_table->live_entries++;
-
     status = _cairo_hash_table_resize (hash_table);
-    if (status) {
+    if (_cairo_unlikely (status)) {
 	/* abort the insert... */
-	*entry = DEAD_ENTRY;
 	hash_table->live_entries--;
 	return status;
     }
 
+    *_cairo_hash_table_lookup_unique_key (hash_table,
+					  key_and_value) = key_and_value;
+
     return CAIRO_STATUS_SUCCESS;
 }
 
+static cairo_hash_entry_t **
+_cairo_hash_table_lookup_exact_key (cairo_hash_table_t *hash_table,
+				    cairo_hash_entry_t *key)
+{
+    unsigned long table_size, i, idx, step;
+    cairo_hash_entry_t **entry;
+
+    table_size = hash_table->arrangement->size;
+    idx = key->hash % table_size;
+
+    entry = &hash_table->entries[idx];
+    if (*entry == key)
+	return entry;
+
+    i = 1;
+    step = key->hash % hash_table->arrangement->rehash;
+    if (step == 0)
+	step = 1;
+    do {
+	idx += step;
+	if (idx >= table_size)
+	    idx -= table_size;
+
+	entry = &hash_table->entries[idx];
+	if (*entry == key)
+	    return entry;
+    } while (++i < table_size);
+
+    ASSERT_NOT_REACHED;
+    return NULL;
+}
 /**
  * _cairo_hash_table_remove:
  * @hash_table: a hash table
  * @key: key of entry to be removed
  *
- * Remove an entry from the hash table which has a key that matches
- * @key, if any (as determined by the keys_equal() function passed to
- * _cairo_hash_table_create).
+ * Remove an entry from the hash table which points to @key.
  *
  * Return value: %CAIRO_STATUS_SUCCESS if successful or
  * %CAIRO_STATUS_NO_MEMORY if out of memory.
@@ -500,13 +491,7 @@ void
 _cairo_hash_table_remove (cairo_hash_table_t *hash_table,
 			  cairo_hash_entry_t *key)
 {
-    cairo_hash_entry_t **entry;
-
-    entry = _cairo_hash_table_lookup_internal (hash_table, key, FALSE);
-    if (! ENTRY_IS_LIVE(*entry))
-	return;
-
-    *entry = DEAD_ENTRY;
+    *_cairo_hash_table_lookup_exact_key (hash_table, key) = DEAD_ENTRY;
     hash_table->live_entries--;
 
     /* Check for table resize. Don't do this when iterating as this will
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index af217c6..aa1a2c8 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -476,7 +476,7 @@ _cairo_scaled_font_unregister_placeholder_and_lock_font_map (cairo_scaled_font_t
     assert (CAIRO_MUTEX_IS_LOCKED (placeholder_scaled_font->mutex));
 
     _cairo_hash_table_remove (cairo_scaled_font_map->hash_table,
-			      &scaled_font->hash_entry);
+			      &placeholder_scaled_font->hash_entry);
 
     CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_map_mutex);
 
@@ -817,7 +817,8 @@ cairo_scaled_font_create (cairo_font_face_t          *font_face,
 	}
 
 	/* the font has been put into an error status - abandon the cache */
-	_cairo_hash_table_remove (font_map->hash_table, &key.hash_entry);
+	_cairo_hash_table_remove (font_map->hash_table,
+				  &scaled_font->hash_entry);
 	scaled_font->hash_entry.hash = ZOMBIE;
     }
     else
@@ -876,7 +877,8 @@ cairo_scaled_font_create (cairo_font_face_t          *font_face,
 	    }
 
 	    /* the font has been put into an error status - abandon the cache */
-	    _cairo_hash_table_remove (font_map->hash_table, &key.hash_entry);
+	    _cairo_hash_table_remove (font_map->hash_table,
+				      &scaled_font->hash_entry);
 	    scaled_font->hash_entry.hash = ZOMBIE;
 	}
     }
@@ -1035,7 +1037,8 @@ cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font)
 		lru = font_map->holdovers[0];
 		assert (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&lru->ref_count));
 
-		_cairo_hash_table_remove (font_map->hash_table, &lru->hash_entry);
+		_cairo_hash_table_remove (font_map->hash_table,
+					  &lru->hash_entry);
 
 		font_map->num_holdovers--;
 		memmove (&font_map->holdovers[0],


More information about the cairo-commit mailing list