[paint] Optimize PAINT_COMPOSITE

At the start of each paint call the current group is clear.
So we don't need to start a new group for the backdrop paint.

A paint composite really needs one group push, not two.
This commit is contained in:
Behdad Esfahbod 2023-01-07 13:55:17 -07:00
parent 5ea5aacda9
commit d045de78c1
2 changed files with 0 additions and 4 deletions

View File

@ -1245,12 +1245,10 @@ struct PaintComposite
void paint_glyph (hb_paint_context_t *c) const void paint_glyph (hb_paint_context_t *c) const
{ {
c->funcs->push_group (c->data);
c->recurse (this+backdrop); c->recurse (this+backdrop);
c->funcs->push_group (c->data); c->funcs->push_group (c->data);
c->recurse (this+src); c->recurse (this+src);
c->funcs->pop_group (c->data, (hb_paint_composite_mode_t) (int) mode); c->funcs->pop_group (c->data, (hb_paint_composite_mode_t) (int) mode);
c->funcs->pop_group (c->data, HB_PAINT_COMPOSITE_MODE_SRC_OVER);
} }
HBUINT8 format; /* format = 32 */ HBUINT8 format; /* format = 32 */

View File

@ -392,12 +392,10 @@ _hb_ft_paint (hb_ft_paint_context_t *c,
break; break;
case FT_COLR_PAINTFORMAT_COMPOSITE: case FT_COLR_PAINTFORMAT_COMPOSITE:
{ {
c->funcs->push_group (c->data);
c->recurse (paint.u.composite.backdrop_paint); c->recurse (paint.u.composite.backdrop_paint);
c->funcs->push_group (c->data); c->funcs->push_group (c->data);
c->recurse (paint.u.composite.source_paint); c->recurse (paint.u.composite.source_paint);
c->funcs->pop_group (c->data, _hb_ft_paint_composite_mode (paint.u.composite.composite_mode)); c->funcs->pop_group (c->data, _hb_ft_paint_composite_mode (paint.u.composite.composite_mode));
c->funcs->pop_group (c->data, HB_PAINT_COMPOSITE_MODE_SRC_OVER);
} }
break; break;