From d045de78c1ff7b32f3d7082591f4112d1f8f796a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 7 Jan 2023 13:55:17 -0700 Subject: [PATCH] [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. --- src/OT/Color/COLR/COLR.hh | 2 -- src/hb-ft-colr.hh | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/OT/Color/COLR/COLR.hh b/src/OT/Color/COLR/COLR.hh index be1ac0887..d46384c1f 100644 --- a/src/OT/Color/COLR/COLR.hh +++ b/src/OT/Color/COLR/COLR.hh @@ -1245,12 +1245,10 @@ struct PaintComposite void paint_glyph (hb_paint_context_t *c) const { - c->funcs->push_group (c->data); c->recurse (this+backdrop); c->funcs->push_group (c->data); 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_SRC_OVER); } HBUINT8 format; /* format = 32 */ diff --git a/src/hb-ft-colr.hh b/src/hb-ft-colr.hh index 11a27a0ee..e1f234f8f 100644 --- a/src/hb-ft-colr.hh +++ b/src/hb-ft-colr.hh @@ -392,12 +392,10 @@ _hb_ft_paint (hb_ft_paint_context_t *c, break; case FT_COLR_PAINTFORMAT_COMPOSITE: { - c->funcs->push_group (c->data); c->recurse (paint.u.composite.backdrop_paint); c->funcs->push_group (c->data); 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_PAINT_COMPOSITE_MODE_SRC_OVER); } break;