Remove dirty tracking
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 11 Oct 2017 10:23:35 +0000 (12:23 +0200)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 11 Oct 2017 10:23:35 +0000 (12:23 +0200)
Turns out I don't need this to resolve CoreText optical sizing
issue after all.

https://github.com/behdad/harfbuzz/issues/360

src/hb-face-private.hh
src/hb-face.cc
src/hb-font-private.hh
src/hb-font.cc

index 72f08a5..43e7b1c 100644 (file)
@@ -54,13 +54,6 @@ struct hb_face_t {
   mutable unsigned int upem;           /* Units-per-EM. */
   mutable unsigned int num_glyphs;     /* Number of glyphs. */
 
-  enum dirty_t {
-    DIRTY_NOTHING      = 0x0000,
-    DIRTY_INDEX                = 0x0001,
-    DIRTY_UPEM         = 0x0002,
-    DIRTY_NUM_GLYPHS   = 0x0004,
-  } dirty;
-
   struct hb_shaper_data_t shaper_data; /* Various shaper data. */
 
   /* Various non-shaping data. */
@@ -106,8 +99,6 @@ struct hb_face_t {
   HB_INTERNAL void load_num_glyphs (void) const;
 };
 
-HB_MARK_AS_FLAG_T (hb_face_t::dirty_t);
-
 extern HB_INTERNAL const hb_face_t _hb_face_nil;
 
 #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
index 22998f0..d7d736d 100644 (file)
@@ -51,8 +51,6 @@ const hb_face_t _hb_face_nil = {
   1000, /* upem */
   0,    /* num_glyphs */
 
-  hb_face_t::DIRTY_NOTHING, /* dirty */
-
   {
 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
 #include "hb-shaper-list.hh"
@@ -367,11 +365,6 @@ hb_face_set_index (hb_face_t    *face,
   if (face->immutable)
     return;
 
-  if (face->index == index)
-    return;
-
-  face->dirty |= face->DIRTY_INDEX;
-
   face->index = index;
 }
 
@@ -407,11 +400,6 @@ hb_face_set_upem (hb_face_t    *face,
   if (face->immutable)
     return;
 
-  if (face->upem == upem)
-    return;
-
-  face->dirty |= face->DIRTY_UPEM;
-
   face->upem = upem;
 }
 
@@ -456,11 +444,6 @@ hb_face_set_glyph_count (hb_face_t    *face,
   if (face->immutable)
     return;
 
-  if (face->num_glyphs == glyph_count)
-    return;
-
-  face->dirty |= face->DIRTY_NUM_GLYPHS;
-
   face->num_glyphs = glyph_count;
 }
 
index 30661c3..d2801fb 100644 (file)
@@ -118,17 +118,6 @@ struct hb_font_t {
   void              *user_data;
   hb_destroy_func_t  destroy;
 
-  enum dirty_t {
-    DIRTY_NOTHING      = 0x0000,
-    DIRTY_FACE         = 0x0001,
-    DIRTY_PARENT       = 0x0002,
-    DIRTY_FUNCS                = 0x0004,
-    DIRTY_SCALE                = 0x0008,
-    DIRTY_PPEM         = 0x0010,
-    DIRTY_PTEM         = 0x0020,
-    DIRTY_VARIATIONS   = 0x0040,
-  } dirty;
-
   struct hb_shaper_data_t shaper_data;
 
 
@@ -556,8 +545,6 @@ struct hb_font_t {
   }
 };
 
-HB_MARK_AS_FLAG_T (hb_font_t::dirty_t);
-
 #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, font);
 #include "hb-shaper-list.hh"
index c47e2c1..8884207 100644 (file)
@@ -1209,8 +1209,6 @@ hb_font_get_empty (void)
     NULL, /* user_data */
     NULL, /* destroy */
 
-    hb_font_t::DIRTY_NOTHING, /* dirty */
-
     {
 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
 #include "hb-shaper-list.hh"
@@ -1363,11 +1361,6 @@ hb_font_set_parent (hb_font_t *font,
   if (!parent)
     parent = hb_font_get_empty ();
 
-  if (parent == font->parent)
-    return;
-
-  font->dirty |= font->DIRTY_PARENT;
-
   hb_font_t *old = font->parent;
 
   font->parent = hb_font_reference (parent);
@@ -1410,11 +1403,6 @@ hb_font_set_face (hb_font_t *font,
   if (unlikely (!face))
     face = hb_face_get_empty ();
 
-  if (font->face == face)
-    return;
-
-  font->dirty |= font->DIRTY_FACE;
-
   hb_face_t *old = font->face;
 
   font->face = hb_face_reference (face);
@@ -1468,8 +1456,6 @@ hb_font_set_funcs (hb_font_t         *font,
   if (!klass)
     klass = hb_font_funcs_get_empty ();
 
-  font->dirty |= font->DIRTY_FUNCS;
-
   hb_font_funcs_reference (klass);
   hb_font_funcs_destroy (font->klass);
   font->klass = klass;
@@ -1525,11 +1511,6 @@ hb_font_set_scale (hb_font_t *font,
   if (font->immutable)
     return;
 
-  if (font->x_scale == x_scale && font->y_scale == y_scale)
-    return;
-
-  font->dirty |= font->DIRTY_SCALE;
-
   font->x_scale = x_scale;
   font->y_scale = y_scale;
 }
@@ -1571,11 +1552,6 @@ hb_font_set_ppem (hb_font_t *font,
   if (font->immutable)
     return;
 
-  if (font->x_ppem == x_ppem && font->y_ppem == y_ppem)
-    return;
-
-  font->dirty |= font->DIRTY_PPEM;
-
   font->x_ppem = x_ppem;
   font->y_ppem = y_ppem;
 }
@@ -1614,11 +1590,6 @@ hb_font_set_ptem (hb_font_t *font, float ptem)
   if (font->immutable)
     return;
 
-  if (font->ptem == ptem)
-    return;
-
-  font->dirty |= font->DIRTY_PTEM;
-
   font->ptem = ptem;
 }
 
@@ -1647,16 +1618,6 @@ _hb_font_adopt_var_coords_normalized (hb_font_t *font,
                                      int *coords, /* 2.14 normalized */
                                      unsigned int coords_length)
 {
-  if (font->num_coords == coords_length &&
-      (coords_length == 0 ||
-       0 == memcmp (font->coords, coords, coords_length * sizeof (coords[0]))))
-  {
-    free (coords);
-    return;
-  }
-
-  font->dirty |= font->DIRTY_VARIATIONS;
-
   free (font->coords);
 
   font->coords = coords;