[paint] Try to adjust both renderers to use same clip order

This commit is contained in:
Behdad Esfahbod 2023-01-08 12:42:34 -07:00
parent 3fd6c0d97a
commit f283d4d366
2 changed files with 14 additions and 7 deletions

View File

@ -2052,8 +2052,7 @@ struct COLR
&extents,
instancer))
{
c.funcs->push_root_transform (c.data, font);
font->scale_glyph_extents (&extents);
c.funcs->push_clip_rectangle (c.data,
extents.x_bearing,
extents.y_bearing + extents.height,
@ -2062,8 +2061,6 @@ 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;
@ -2074,6 +2071,16 @@ struct COLR
hb_extents_t extents = extents_data.get_extents ();
is_bounded = extents_data.is_bounded ();
/* Transform extents... */
/* Copied from paint.hh push_root_transform(). */
float upem = font->face->get_upem ();
int xscale = font->x_scale, yscale = font->y_scale;
float slant = font->slant_xy;
hb_transform_t t (xscale/upem, 0, slant * yscale/upem, yscale/upem, 0, 0);
t.transform_extents (extents);
c.funcs->push_clip_rectangle (c.data,
extents.xmin,
extents.ymin,
@ -2082,12 +2089,13 @@ struct COLR
}
}
c.funcs->push_root_transform (c.data, font);
if (is_bounded)
c.recurse (*paint);
// We push root transform first and clip after in this backend
c.funcs->pop_clip (c.data);
c.funcs->pop_transform (c.data);
c.funcs->pop_clip (c.data);
return true;
}

View File

@ -478,7 +478,6 @@ hb_ft_paint_glyph_colr (hb_font_t *font,
if (is_bounded)
c.recurse (paint);
// We push clip first and root transform after in this backend
c.funcs->pop_transform (c.data);
c.funcs->pop_clip (c.data);