[paint] Fix paint_extents usage

It was broken all this time :(.

The two backends do this slightly differently...
pull/4017/head
Behdad Esfahbod 2 years ago
parent a63d329261
commit 432afa9dff
  1. 13
      src/OT/Color/COLR/COLR.hh
  2. 3
      src/hb-ft-colr.hh

@ -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;
}
}

@ -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 ();

Loading…
Cancel
Save