From 5393e3a62ba09fd7bcf3767b36225c8f49badb9d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 2 Aug 2012 09:24:35 -0400 Subject: [PATCH] [OT] Minor refactoring --- src/hb-ot-map.cc | 4 ---- src/hb-ot-shape-private.hh | 26 ++++++++++++++++++++++++++ src/hb-ot-shape.cc | 26 ++------------------------ src/hb-shape-plan.cc | 2 ++ src/hb-shape.cc | 2 -- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc index 03c9ba1..7192c2b 100644 --- a/src/hb-ot-map.cc +++ b/src/hb-ot-map.cc @@ -28,8 +28,6 @@ #include "hb-ot-map-private.hh" -#include "hb-ot-shape-private.hh" - void hb_ot_map_t::add_lookups (hb_face_t *face, @@ -303,5 +301,3 @@ hb_ot_map_builder_t::compile (hb_face_t *face, } } } - - diff --git a/src/hb-ot-shape-private.hh b/src/hb-ot-shape-private.hh index fd45e2d..89f15be 100644 --- a/src/hb-ot-shape-private.hh +++ b/src/hb-ot-shape-private.hh @@ -35,11 +35,37 @@ struct hb_ot_shape_plan_t { + const hb_ot_complex_shaper_t *shaper; hb_ot_map_t map; +}; + +struct hb_ot_shape_planner_t +{ + /* In the order that they are filled in. */ + hb_face_t *face; + hb_segment_properties_t props; const hb_ot_complex_shaper_t *shaper; + hb_ot_map_builder_t map; + + hb_ot_shape_planner_t (const hb_shape_plan_t *master_plan) : + face (master_plan->face), + props (master_plan->props), + shaper (NULL), + map () {} + ~hb_ot_shape_planner_t (void) { map.finish (); } + + inline void compile (hb_ot_shape_plan_t &plan) + { + plan.shaper = shaper; + map.compile (face, &props, plan.map); + } + + private: + NO_COPY (hb_ot_shape_planner_t); }; + inline void _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode) { diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 66664c5..f6d7a83 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -70,26 +70,6 @@ hb_tag_t vertical_features[] = { -struct hb_ot_shape_planner_t -{ - hb_ot_map_builder_t map; - const hb_ot_complex_shaper_t *shaper; - - hb_ot_shape_planner_t (void) : map () {} - ~hb_ot_shape_planner_t (void) { map.finish (); } - - inline void compile (hb_face_t *face, - const hb_segment_properties_t *props, - hb_ot_shape_plan_t &plan) - { - plan.shaper = shaper; - map.compile (face, props, plan.map); - } - - private: - NO_COPY (hb_ot_shape_planner_t); -}; - static void hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, const hb_segment_properties_t *props, @@ -188,15 +168,13 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan, if (unlikely (!data)) return NULL; - hb_ot_shape_planner_t planner; - - assert (HB_DIRECTION_IS_VALID (shape_plan->props.direction)); + hb_ot_shape_planner_t planner (shape_plan); planner.shaper = hb_ot_shape_complex_categorize (&shape_plan->props); hb_ot_shape_collect_features (&planner, &shape_plan->props, user_features, num_user_features); - planner.compile (shape_plan->face, &shape_plan->props, *data); + planner.compile (*data); return data; } diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc index a478ba5..974c370 100644 --- a/src/hb-shape-plan.cc +++ b/src/hb-shape-plan.cc @@ -90,6 +90,8 @@ hb_shape_plan_create (hb_face_t *face, unsigned int num_user_features, const char * const *shaper_list) { + assert (props->direction != HB_DIRECTION_INVALID); + hb_shape_plan_t *shape_plan; if (unlikely (!face)) diff --git a/src/hb-shape.cc b/src/hb-shape.cc index b3d373b..5aa587b 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -87,8 +87,6 @@ hb_shape_full (hb_font_t *font, buffer->guess_properties (); - assert (buffer->props.direction != HB_DIRECTION_INVALID); - hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer->props, features, num_features, shaper_list); hb_bool_t res = hb_shape_plan_execute (shape_plan, font, buffer, features, num_features); hb_shape_plan_destroy (shape_plan); -- 2.7.4