[paint-extents] Lazy-load paint_extents funcs
This commit is contained in:
parent
4280ed290d
commit
1c595ec17f
|
@ -479,8 +479,6 @@ hb_ft_paint_glyph_colr (hb_font_t *font,
|
||||||
extents.ymin,
|
extents.ymin,
|
||||||
extents.xmax,
|
extents.xmax,
|
||||||
extents.ymax);
|
extents.ymax);
|
||||||
|
|
||||||
hb_paint_funcs_destroy (extents_funcs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
paint_funcs->push_root_transform (paint_data, font);
|
paint_funcs->push_root_transform (paint_data, font);
|
||||||
|
|
|
@ -2008,8 +2008,6 @@ struct COLR
|
||||||
extents->width = e.xmax - e.xmin;
|
extents->width = e.xmax - e.xmin;
|
||||||
extents->height = e.ymin - e.ymax;
|
extents->height = e.ymin - e.ymax;
|
||||||
|
|
||||||
hb_paint_funcs_destroy (extents_funcs);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2067,8 +2065,6 @@ struct COLR
|
||||||
extents.xmax,
|
extents.xmax,
|
||||||
extents.ymax);
|
extents.ymax);
|
||||||
|
|
||||||
hb_paint_funcs_destroy (extents_funcs);
|
|
||||||
|
|
||||||
c.funcs->push_root_transform (c.data, font);
|
c.funcs->push_root_transform (c.data, font);
|
||||||
|
|
||||||
pop_clip_first = false;
|
pop_clip_first = false;
|
||||||
|
|
|
@ -122,6 +122,7 @@ static struct hb_draw_extents_funcs_lazy_loader_t : hb_draw_funcs_lazy_loader_t<
|
||||||
static hb_draw_funcs_t *create ()
|
static hb_draw_funcs_t *create ()
|
||||||
{
|
{
|
||||||
hb_draw_funcs_t *funcs = hb_draw_funcs_create ();
|
hb_draw_funcs_t *funcs = hb_draw_funcs_create ();
|
||||||
|
|
||||||
hb_draw_funcs_set_move_to_func (funcs, hb_draw_extents_move_to, nullptr, nullptr);
|
hb_draw_funcs_set_move_to_func (funcs, hb_draw_extents_move_to, nullptr, nullptr);
|
||||||
hb_draw_funcs_set_line_to_func (funcs, hb_draw_extents_line_to, nullptr, nullptr);
|
hb_draw_funcs_set_line_to_func (funcs, hb_draw_extents_line_to, nullptr, nullptr);
|
||||||
hb_draw_funcs_set_cubic_to_func (funcs, hb_draw_extents_cubic_to, nullptr, nullptr);
|
hb_draw_funcs_set_cubic_to_func (funcs, hb_draw_extents_cubic_to, nullptr, nullptr);
|
||||||
|
@ -281,9 +282,12 @@ hb_paint_extents_paint_sweep_gradient (hb_paint_funcs_t *funcs HB_UNUSED,
|
||||||
c->paint ();
|
c->paint ();
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_paint_funcs_t *
|
static inline void free_static_paint_extents_funcs ();
|
||||||
hb_paint_extents_get_funcs ()
|
|
||||||
|
static struct hb_paint_extents_funcs_lazy_loader_t : hb_paint_funcs_lazy_loader_t<hb_paint_extents_funcs_lazy_loader_t>
|
||||||
{
|
{
|
||||||
|
static hb_paint_funcs_t *create ()
|
||||||
|
{
|
||||||
hb_paint_funcs_t *funcs = hb_paint_funcs_create ();
|
hb_paint_funcs_t *funcs = hb_paint_funcs_create ();
|
||||||
|
|
||||||
hb_paint_funcs_set_push_transform_func (funcs, hb_paint_extents_push_transform, nullptr, nullptr);
|
hb_paint_funcs_set_push_transform_func (funcs, hb_paint_extents_push_transform, nullptr, nullptr);
|
||||||
|
@ -299,5 +303,22 @@ hb_paint_extents_get_funcs ()
|
||||||
hb_paint_funcs_set_radial_gradient_func (funcs, hb_paint_extents_paint_radial_gradient, nullptr, nullptr);
|
hb_paint_funcs_set_radial_gradient_func (funcs, hb_paint_extents_paint_radial_gradient, nullptr, nullptr);
|
||||||
hb_paint_funcs_set_sweep_gradient_func (funcs, hb_paint_extents_paint_sweep_gradient, nullptr, nullptr);
|
hb_paint_funcs_set_sweep_gradient_func (funcs, hb_paint_extents_paint_sweep_gradient, nullptr, nullptr);
|
||||||
|
|
||||||
|
hb_paint_funcs_make_immutable (funcs);
|
||||||
|
|
||||||
|
hb_atexit (free_static_paint_extents_funcs);
|
||||||
|
|
||||||
return funcs;
|
return funcs;
|
||||||
|
}
|
||||||
|
} static_paint_extents_funcs;
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void free_static_paint_extents_funcs ()
|
||||||
|
{
|
||||||
|
static_paint_extents_funcs.free_instance ();
|
||||||
|
}
|
||||||
|
|
||||||
|
hb_paint_funcs_t *
|
||||||
|
hb_paint_extents_get_funcs ()
|
||||||
|
{
|
||||||
|
return static_paint_extents_funcs.get_unconst ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue