[paint-extents] Clean up
This commit is contained in:
parent
dbea503a38
commit
02684751bd
|
@ -456,6 +456,7 @@ hb_ft_paint_glyph_colr (hb_font_t *font,
|
||||||
FT_COLOR_NO_ROOT_TRANSFORM,
|
FT_COLOR_NO_ROOT_TRANSFORM,
|
||||||
&paint))
|
&paint))
|
||||||
{
|
{
|
||||||
|
bool is_bounded = true;
|
||||||
FT_ClipBox clip_box;
|
FT_ClipBox clip_box;
|
||||||
if (FT_Get_Color_Glyph_ClipBox (ft_face, gid, &clip_box))
|
if (FT_Get_Color_Glyph_ClipBox (ft_face, gid, &clip_box))
|
||||||
paint_funcs->push_clip_rectangle (paint_data,
|
paint_funcs->push_clip_rectangle (paint_data,
|
||||||
|
@ -471,11 +472,13 @@ hb_ft_paint_glyph_colr (hb_font_t *font,
|
||||||
extents_funcs, &extents_data,
|
extents_funcs, &extents_data,
|
||||||
palette, foreground);
|
palette, foreground);
|
||||||
_hb_ft_paint (&c, paint);
|
_hb_ft_paint (&c, paint);
|
||||||
|
hb_extents_t extents = extents_data.get_extents ();
|
||||||
|
is_bounded = extents_data.is_bounded ();
|
||||||
paint_funcs->push_clip_rectangle (paint_data,
|
paint_funcs->push_clip_rectangle (paint_data,
|
||||||
extents_data.groups.tail().extents.xmin,
|
extents.xmin,
|
||||||
extents_data.groups.tail().extents.ymin,
|
extents.ymin,
|
||||||
extents_data.groups.tail().extents.xmax,
|
extents.xmax,
|
||||||
extents_data.groups.tail().extents.ymax);
|
extents.ymax);
|
||||||
|
|
||||||
hb_paint_funcs_destroy (extents_funcs);
|
hb_paint_funcs_destroy (extents_funcs);
|
||||||
}
|
}
|
||||||
|
@ -485,7 +488,9 @@ hb_ft_paint_glyph_colr (hb_font_t *font,
|
||||||
hb_ft_paint_context_t c (ft_font, font,
|
hb_ft_paint_context_t c (ft_font, font,
|
||||||
paint_funcs, paint_data,
|
paint_funcs, paint_data,
|
||||||
palette, foreground);
|
palette, foreground);
|
||||||
_hb_ft_paint (&c, paint);
|
|
||||||
|
if (is_bounded)
|
||||||
|
_hb_ft_paint (&c, paint);
|
||||||
|
|
||||||
paint_funcs->pop_root_transform (paint_data);
|
paint_funcs->pop_root_transform (paint_data);
|
||||||
paint_funcs->pop_clip (paint_data);
|
paint_funcs->pop_clip (paint_data);
|
||||||
|
|
|
@ -2002,10 +2002,11 @@ struct COLR
|
||||||
hb_paint_extents_context_t extents_data;
|
hb_paint_extents_context_t extents_data;
|
||||||
paint_glyph (font, glyph, extents_funcs, &extents_data, 0, HB_COLOR(0,0,0,0));
|
paint_glyph (font, glyph, extents_funcs, &extents_data, 0, HB_COLOR(0,0,0,0));
|
||||||
|
|
||||||
extents->x_bearing = extents_data.groups.tail().extents.xmin;
|
hb_extents_t e = extents_data.get_extents ();
|
||||||
extents->y_bearing = extents_data.groups.tail().extents.ymax;
|
extents->x_bearing = e.xmin;
|
||||||
extents->width = extents_data.groups.tail().extents.xmax - extents_data.groups.tail().extents.xmin,
|
extents->y_bearing = e.ymax;
|
||||||
extents->height = extents_data.groups.tail().extents.ymin - extents_data.groups.tail().extents.ymax;
|
extents->width = e.xmax - e.xmin,
|
||||||
|
extents->height = e.ymin - e.ymax;
|
||||||
|
|
||||||
hb_paint_funcs_destroy (extents_funcs);
|
hb_paint_funcs_destroy (extents_funcs);
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,16 @@ struct hb_paint_extents_context_t {
|
||||||
transforms.push (hb_transform_t{});
|
transforms.push (hb_transform_t{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hb_extents_t get_extents ()
|
||||||
|
{
|
||||||
|
return groups.tail().extents;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_bounded ()
|
||||||
|
{
|
||||||
|
return groups.tail().status != hb_bounds_t::status_t::UNBOUNDED;
|
||||||
|
}
|
||||||
|
|
||||||
void push_transform (const hb_transform_t &trans)
|
void push_transform (const hb_transform_t &trans)
|
||||||
{
|
{
|
||||||
hb_transform_t r = transforms.tail ();
|
hb_transform_t r = transforms.tail ();
|
||||||
|
|
Loading…
Reference in New Issue