[paint] Fixup

This commit is contained in:
Behdad Esfahbod 2022-12-31 11:55:45 -07:00
parent 6b47fcb17a
commit 9e3ff0e9f0
2 changed files with 15 additions and 2 deletions

View File

@ -336,6 +336,7 @@ _hb_ft_paint (hb_ft_paint_context_t *c,
{
float dx = paint.u.translate.dx / 65536.f;
float dy = paint.u.translate.dy / 65536.f;
c->funcs->push_translate (c->data, dx, dy);
c->recurse (paint.u.translate.paint);
c->funcs->pop_translate (c->data, dx, dy);
@ -347,6 +348,7 @@ _hb_ft_paint (hb_ft_paint_context_t *c,
float dy = paint.u.scale.center_y / 65536.f;
float sx = paint.u.scale.scale_x / 65536.f;
float sy = paint.u.scale.scale_y / 65536.f;
c->funcs->push_translate (c->data, +dx, +dy);
c->funcs->push_scale (c->data, sx, sy);
c->funcs->push_translate (c->data, -dx, -dy);
@ -361,6 +363,7 @@ _hb_ft_paint (hb_ft_paint_context_t *c,
float dx = paint.u.rotate.center_x / 65536.f;
float dy = paint.u.rotate.center_y / 65536.f;
float a = paint.u.rotate.angle / 65536.f;
c->funcs->push_translate (c->data, +dx, +dy);
c->funcs->push_rotate (c->data, a);
c->funcs->push_translate (c->data, -dx, -dy);
@ -376,6 +379,7 @@ _hb_ft_paint (hb_ft_paint_context_t *c,
float dy = paint.u.skew.center_y / 65536.f;
float sx = paint.u.skew.x_skew_angle / 65536.f;
float sy = paint.u.skew.y_skew_angle / 65536.f;
c->funcs->push_translate (c->data, +dx, +dy);
c->funcs->push_skew (c->data, sx, sy);
c->funcs->push_translate (c->data, -dx, -dy);

View File

@ -887,6 +887,7 @@ struct PaintTranslate
{
float ddx = dx + c->instancer (varIdxBase, 0);
float ddy = dy + c->instancer (varIdxBase, 1);
c->funcs->push_translate (c->data, ddx, ddy);
c->recurse (this+src);
c->funcs->pop_translate (c->data, ddx, ddy);
@ -923,6 +924,7 @@ struct PaintScale
{
float sx = scaleX.to_float (c->instancer (varIdxBase, 0));
float sy = scaleY.to_float (c->instancer (varIdxBase, 1));
c->funcs->push_scale (c->data, sx, sy);
c->recurse (this+src);
c->funcs->pop_scale (c->data, sx, sy);
@ -961,6 +963,7 @@ struct PaintScaleAroundCenter
float sy = scaleY.to_float (c->instancer (varIdxBase, 1));
float tCenterX = centerX + c->instancer (varIdxBase, 2);
float tCenterY = centerY + c->instancer (varIdxBase, 3);
c->funcs->push_translate (c->data, +tCenterX, +tCenterY);
c->funcs->push_scale (c->data, sx, sy);
c->funcs->push_translate (c->data, -tCenterX, -tCenterY);
@ -1002,6 +1005,7 @@ struct PaintScaleUniform
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
{
float s = scale + c->instancer (varIdxBase, 0);
c->funcs->push_scale (c->data, s, s);
c->recurse (this+src);
c->funcs->pop_scale (c->data, s, s);
@ -1038,13 +1042,14 @@ struct PaintScaleUniformAroundCenter
float s = scale + c->instancer (varIdxBase, 0);
float tCenterX = centerX + c->instancer (varIdxBase, 1);
float tCenterY = centerY + c->instancer (varIdxBase, 2);
c->funcs->push_translate (c->data, +tCenterX, +tCenterY);
c->funcs->push_scale (c->data, s, s);
c->funcs->push_translate (c->data, -tCenterX, -tCenterY);
c->recurse (this+src);
c->funcs->push_translate (c->data, -tCenterX, -tCenterY);
c->funcs->pop_translate (c->data, -tCenterX, -tCenterY);
c->funcs->pop_scale (c->data, s, s);
c->funcs->push_translate (c->data, +tCenterX, +tCenterY);
c->funcs->pop_translate (c->data, +tCenterX, +tCenterY);
}
HBUINT8 format; /* format = 22 (noVar) or 23(Var) */
@ -1078,6 +1083,7 @@ struct PaintRotate
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
{
float a = angle.to_float (c->instancer (varIdxBase, 0));
c->funcs->push_rotate (c->data, a);
c->recurse (this+src);
c->funcs->pop_rotate (c->data, a);
@ -1114,6 +1120,7 @@ struct PaintRotateAroundCenter
float a = angle.to_float (c->instancer (varIdxBase, 0));
float tCenterX = centerX + c->instancer (varIdxBase, 1);
float tCenterY = centerY + c->instancer (varIdxBase, 2);
c->funcs->push_translate (c->data, +tCenterX, +tCenterY);
c->funcs->push_rotate (c->data, a);
c->funcs->push_translate (c->data, -tCenterX, -tCenterY);
@ -1155,6 +1162,7 @@ struct PaintSkew
{
float sx = xSkewAngle.to_float(c->instancer (varIdxBase, 0));
float sy = ySkewAngle.to_float(c->instancer (varIdxBase, 1));
c->funcs->push_skew (c->data, sx, sy);
c->recurse (this+src);
c->funcs->pop_skew (c->data, sx, sy);
@ -1193,6 +1201,7 @@ struct PaintSkewAroundCenter
float sy = ySkewAngle.to_float(c->instancer (varIdxBase, 1));
float tCenterX = centerX + c->instancer (varIdxBase, 2);
float tCenterY = centerY + c->instancer (varIdxBase, 3);
c->funcs->push_translate (c->data, +tCenterX, +tCenterY);
c->funcs->push_skew (c->data, sx, sy);
c->funcs->push_translate (c->data, -tCenterX, -tCenterY);