From cfdc34b44d97bedfe482612f885f52641452390f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 22 Dec 2022 17:58:36 -0700 Subject: [PATCH] [ft-paint] Implement FT_COLR_PAINTFORMAT_SKEW --- src/hb-ft-colr.hh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/hb-ft-colr.hh b/src/hb-ft-colr.hh index 5cdd98306..a4c807fd5 100644 --- a/src/hb-ft-colr.hh +++ b/src/hb-ft-colr.hh @@ -207,7 +207,26 @@ _hb_ft_paint (FT_OpaquePaint opaque_paint, paint_funcs->pop_transform (paint_data); paint_funcs->pop_transform (paint_data); } - case FT_COLR_PAINTFORMAT_SKEW: break; + break; + case FT_COLR_PAINTFORMAT_SKEW: + { + float x = +tanf (paint.u.skew.x_skew_angle / 65536.f * (float) M_PI); + float y = -tanf (paint.u.skew.y_skew_angle / 65536.f * (float) M_PI); + paint_funcs->push_transform (paint_data, + 1.f, 0.f, 0.f, 1.f, + +paint.u.skew.center_x / 65536.f, + +paint.u.skew.center_y / 65536.f); + paint_funcs->push_transform (paint_data, 1., y, x, 1., 0., 0.); + paint_funcs->push_transform (paint_data, + 1.f, 0.f, 0.f, 1.f, + -paint.u.skew.center_x / 65536.f, + -paint.u.skew.center_y / 65536.f); + paint_recurse (paint.u.skew.paint); + paint_funcs->pop_transform (paint_data); + paint_funcs->pop_transform (paint_data); + paint_funcs->pop_transform (paint_data); + } + break; case FT_COLR_PAINTFORMAT_COMPOSITE: { paint_funcs->push_group (paint_data);