提交 d3d36918 编写于 作者: B Behdad Esfahbod

Add dirty-state tracking to hb_face_t

上级 2171f48b
......@@ -54,6 +54,13 @@ struct hb_face_t {
mutable unsigned int upem; /* Units-per-EM. */
mutable unsigned int num_glyphs; /* Number of glyphs. */
enum dirty_t {
NOTHING = 0x0000,
INDEX = 0x0001,
UPEM = 0x0002,
NUM_GLYPHS = 0x0004,
} dirty;
struct hb_shaper_data_t shaper_data; /* Various shaper data. */
/* Various non-shaping data. */
......@@ -99,6 +106,8 @@ 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
......
......@@ -51,6 +51,8 @@ const hb_face_t _hb_face_nil = {
1000, /* upem */
0, /* num_glyphs */
hb_face_t::NOTHING, /* dirty */
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
#include "hb-shaper-list.hh"
......@@ -171,7 +173,7 @@ hb_face_create (hb_blob_t *blob,
closure,
(hb_destroy_func_t) _hb_face_for_data_closure_destroy);
hb_face_set_index (face, index);
face->index = index;
return face;
}
......@@ -365,6 +367,11 @@ hb_face_set_index (hb_face_t *face,
if (face->immutable)
return;
if (face->index == index)
return;
face->dirty |= face->INDEX;
face->index = index;
}
......@@ -400,6 +407,11 @@ hb_face_set_upem (hb_face_t *face,
if (face->immutable)
return;
if (face->upem == upem)
return;
face->dirty |= face->UPEM;
face->upem = upem;
}
......@@ -444,6 +456,11 @@ hb_face_set_glyph_count (hb_face_t *face,
if (face->immutable)
return;
if (face->num_glyphs == glyph_count)
return;
face->dirty |= face->NUM_GLYPHS;
face->num_glyphs = glyph_count;
}
......
......@@ -1196,7 +1196,7 @@ hb_font_get_empty (void)
NULL, /* user_data */
NULL, /* destroy */
hb_font_t::NOTHING, /* dirty_bits */
hb_font_t::NOTHING, /* dirty */
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册