[paint] Fix paint_extents usage

It was broken all this time :(.

The two backends do this slightly differently...
This commit is contained in:
Behdad Esfahbod 2023-01-07 16:25:30 -07:00
parent a63d329261
commit 432afa9dff
2 changed files with 6 additions and 10 deletions

View File

@ -2045,7 +2045,6 @@ struct COLR
hb_array (font->coords, font->num_coords));
bool is_bounded = true;
bool pop_clip_first = true;
if (clip)
{
hb_glyph_extents_t extents;
@ -2063,6 +2062,8 @@ struct COLR
}
else
{
c.funcs->push_root_transform (c.data, font);
auto *extents_funcs = hb_paint_extents_get_funcs ();
hb_paint_extents_context_t extents_data;
@ -2078,24 +2079,16 @@ struct COLR
extents.ymin,
extents.xmax,
extents.ymax);
c.funcs->push_root_transform (c.data, font);
pop_clip_first = false;
}
}
if (is_bounded)
c.recurse (*paint);
if (clip && pop_clip_first)
c.funcs->pop_clip (c.data);
c.funcs->pop_clip (c.data);
c.funcs->pop_transform (c.data);
if (clip && !pop_clip_first)
c.funcs->pop_clip (c.data);
return true;
}
}

View File

@ -454,12 +454,15 @@ hb_ft_paint_glyph_colr (hb_font_t *font,
}
else
{
auto *extents_funcs = hb_paint_extents_get_funcs ();
hb_paint_extents_context_t extents_data;
hb_ft_paint_context_t ce (ft_font, font,
extents_funcs, &extents_data,
palette, foreground);
ce.funcs->push_root_transform (ce.data, font);
ce.recurse (paint);
ce.funcs->pop_transform (ce.data);
hb_extents_t extents = extents_data.get_extents ();
is_bounded = extents_data.is_bounded ();