From 0275151490902461d2680056820b766c7d39c208 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 9 Jan 2023 12:26:39 -0700 Subject: [PATCH] [paint] Align deptch/edge count conditions across two backends --- src/OT/Color/COLR/COLR.hh | 4 ++-- src/hb-ft-colr.hh | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/OT/Color/COLR/COLR.hh b/src/OT/Color/COLR/COLR.hh index a639c44fd..d1f96a5c4 100644 --- a/src/OT/Color/COLR/COLR.hh +++ b/src/OT/Color/COLR/COLR.hh @@ -2139,10 +2139,10 @@ struct COLR_accelerator_t : COLR::accelerator_t { void hb_paint_context_t::recurse (const Paint &paint) { + if (unlikely (depth_left <= 0 || edge_count <= 0)) return; depth_left--; edge_count--; - if (depth_left > 0 && edge_count > 0) - paint.dispatch (this); + paint.dispatch (this); depth_left++; } diff --git a/src/hb-ft-colr.hh b/src/hb-ft-colr.hh index a5920abb7..7266c4f23 100644 --- a/src/hb-ft-colr.hh +++ b/src/hb-ft-colr.hh @@ -90,8 +90,7 @@ struct hb_ft_paint_context_t void recurse (FT_OpaquePaint paint) { - if (depth_left <= 0) return; - if (edge_count <= 0) return; + if (unlikely (depth_left <= 0 || edge_count <= 0)) return; depth_left--; edge_count--; _hb_ft_paint (this, paint);