[pango/kill-ft-face: 9/14] fc: Drop the cmap cache



commit 2148f13e371d3eccf0e9c89bebf2daf00612d2f2
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri May 24 16:28:15 2019 +0000

    fc: Drop the cmap cache
    
    This is now unused.

 pango/pangofc-font.c    |  4 ----
 pango/pangofc-fontmap.c | 51 -------------------------------------------------
 pango/pangofc-private.h | 23 ----------------------
 3 files changed, 78 deletions(-)
---
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 8ecd7574..138fb490 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -63,7 +63,6 @@ struct _PangoFcFontPrivate
 {
   PangoFcDecoder *decoder;
   PangoFcFontKey *key;
-  PangoFcCmapCache *cmap_cache;
 };
 
 static gboolean pango_fc_font_real_has_char  (PangoFcFont *font,
@@ -177,9 +176,6 @@ pango_fc_font_finalize (GObject *object)
   if (priv->decoder)
     _pango_fc_font_set_decoder (fcfont, NULL);
 
-  if (priv->cmap_cache)
-    _pango_fc_cmap_cache_unref (priv->cmap_cache);
-
   G_OBJECT_CLASS (pango_fc_font_parent_class)->finalize (object);
 }
 
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 72f9c70d..e61ed874 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -166,7 +166,6 @@ struct _PangoFcFontFaceData
   /* Data */
   FcPattern *pattern;  /* Referenced pattern that owns filename */
   PangoCoverage *coverage;
-  PangoFcCmapCache *cmap_cache;
 
   hb_face_t *hb_face;
 };
@@ -299,9 +298,6 @@ pango_fc_font_face_data_free (PangoFcFontFaceData *data)
   if (data->coverage)
     pango_coverage_unref (data->coverage);
 
-  if (data->cmap_cache)
-    _pango_fc_cmap_cache_unref (data->cmap_cache);
-
   hb_face_destroy (data->hb_face);
 
   g_slice_free (PangoFcFontFaceData, data);
@@ -1939,53 +1935,6 @@ pango_fc_font_map_get_font_face_data (PangoFcFontMap *fcfontmap,
   return data;
 }
 
-static PangoFcCmapCache *
-_pango_fc_cmap_cache_ref (PangoFcCmapCache *cmap_cache)
-{
-  g_atomic_int_inc ((int *) &cmap_cache->ref_count);
-
-  return cmap_cache;
-}
-
-void
-_pango_fc_cmap_cache_unref (PangoFcCmapCache *cmap_cache)
-{
-  g_return_if_fail (cmap_cache->ref_count > 0);
-
-  if (g_atomic_int_dec_and_test ((int *) &cmap_cache->ref_count))
-    {
-      g_free (cmap_cache);
-    }
-}
-
-PangoFcCmapCache *
-_pango_fc_font_map_get_cmap_cache (PangoFcFontMap *fcfontmap,
-                                  PangoFcFont    *fcfont)
-{
-  PangoFcFontFaceData *data;
-
-  if (G_UNLIKELY (fcfontmap == NULL))
-       return NULL;
-
-  if (G_UNLIKELY (!fcfont->font_pattern))
-    return NULL;
-
-  data = pango_fc_font_map_get_font_face_data (fcfontmap, fcfont->font_pattern);
-  if (G_UNLIKELY (!data))
-    return NULL;
-
-  if (G_UNLIKELY (data->cmap_cache == NULL))
-    {
-      data->cmap_cache = g_new0 (PangoFcCmapCache, 1);
-      data->cmap_cache->ref_count = 1;
-
-      /* Make sure all cache entries are invalid initially */
-      data->cmap_cache->entries[0].ch = 1; /* char 1 cannot happen in bucket 0 */
-    }
-
-  return _pango_fc_cmap_cache_ref (data->cmap_cache);
-}
-
 typedef struct {
   PangoCoverage parent_instance;
 
diff --git a/pango/pangofc-private.h b/pango/pangofc-private.h
index 5babc536..658d68fe 100644
--- a/pango/pangofc-private.h
+++ b/pango/pangofc-private.h
@@ -43,25 +43,6 @@ struct _PangoFcMetricsInfo
 };
 
 
-typedef struct _PangoFcCmapCacheEntry  PangoFcCmapCacheEntry;
-typedef struct _PangoFcCmapCache       PangoFcCmapCache;
-
-#define CMAP_CACHE_NUM_ENTRIES 256 /* should be power of two */
-#define CMAP_CACHE_MASK (CMAP_CACHE_NUM_ENTRIES - 1)
-
-struct _PangoFcCmapCacheEntry
-{
-  gunichar   ch;
-  PangoGlyph glyph;
-};
-
-struct _PangoFcCmapCache
-{
-  guint ref_count;
-  PangoFcCmapCacheEntry entries[CMAP_CACHE_NUM_ENTRIES];
-};
-
-
 #define PANGO_SCALE_26_6 (PANGO_SCALE / (1<<6))
 #define PANGO_PIXELS_26_6(d)                           \
   (((d) >= 0) ?                                                \
@@ -79,10 +60,6 @@ PangoCoverage *_pango_fc_font_map_get_coverage    (PangoFcFontMap *fcfontmap,
                                                   PangoFcFont    *fcfont);
 PangoCoverage  *_pango_fc_font_map_fc_to_coverage (FcCharSet      *charset);
 
-PangoFcCmapCache *_pango_fc_font_map_get_cmap_cache (PangoFcFontMap *fcfontmap,
-                                                    PangoFcFont    *fcfont);
-void              _pango_fc_cmap_cache_unref (PangoFcCmapCache *cmap_cache);
-
 PangoFcDecoder *_pango_fc_font_get_decoder       (PangoFcFont    *font);
 void            _pango_fc_font_set_decoder       (PangoFcFont    *font,
                                                  PangoFcDecoder *decoder);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]