diff --git a/src/hb-gpu-draw.cc b/src/hb-gpu-draw.cc index 63c30ddfd..3da6c0dd6 100644 --- a/src/hb-gpu-draw.cc +++ b/src/hb-gpu-draw.cc @@ -972,10 +972,13 @@ hb_gpu_draw_get_scale (const hb_gpu_draw_t *draw, * @font: font to draw from * @glyph: glyph ID to draw * - * Convenience wrapper that draws a single glyph outline into the - * encoder using hb_font_draw_glyph_or_fail(). Calls - * hb_gpu_draw_set_scale() with the font's scale before walking the - * outline. + * Convenience to draw one glyph outline. Equivalent to: + * + * |[ + * hb_gpu_draw_set_scale (draw, x_scale, y_scale); + * hb_font_draw_glyph_or_fail (font, glyph, + * hb_gpu_draw_get_funcs (draw), draw); + * ]| * * Return value: `true` if the glyph was drawn, `false` if the font * has no outlines for @glyph. diff --git a/src/hb-raster-paint.cc b/src/hb-raster-paint.cc index 8ccf9f929..e75c89775 100644 --- a/src/hb-raster-paint.cc +++ b/src/hb-raster-paint.cc @@ -134,13 +134,6 @@ ensure_initialized (hb_raster_paint_t *c) return; } - /* Initial transform */ - if (unlikely (!c->transform_stack.push_or_fail (c->base_transform))) - { - c->release_surface (c->surface_stack.pop ()); - return; - } - /* Initial clip: full coverage rectangle */ hb_raster_clip_t clip; clip.init_full (c->fixed_extents.width, c->fixed_extents.height); @@ -163,7 +156,6 @@ hb_raster_paint_push_transform (hb_paint_funcs_t *pfuncs HB_UNUSED, hb_raster_paint_t *c = (hb_raster_paint_t *) paint_data; ensure_initialized (c); - if (unlikely (!c->transform_stack.length)) return; hb_transform_t<> t = c->current_transform (); t.multiply ({xx, yx, xy, yy, dx, dy}); @@ -176,7 +168,7 @@ hb_raster_paint_pop_transform (hb_paint_funcs_t *pfuncs HB_UNUSED, void *user_data HB_UNUSED) { hb_raster_paint_t *c = (hb_raster_paint_t *) paint_data; - if (c->transform_stack.length > 1) + if (c->transform_stack.length) c->transform_stack.pop (); } @@ -2230,15 +2222,23 @@ hb_raster_paint_glyph_impl (hb_raster_paint_t *paint, hb_raster_paint_set_glyph_extents (paint, &ge); } + hb_paint_funcs_t *funcs = hb_raster_paint_get_funcs (paint); + hb_paint_push_transform (funcs, paint, + paint->base_transform.xx, paint->base_transform.yx, + paint->base_transform.xy, paint->base_transform.yy, + paint->base_transform.x0, paint->base_transform.y0); + hb_bool_t ret = true; if (fallible) ret = hb_font_paint_glyph_or_fail (font, glyph, - hb_raster_paint_get_funcs (paint), paint, + funcs, paint, paint->palette, paint->foreground); else hb_font_paint_glyph (font, glyph, - hb_raster_paint_get_funcs (paint), paint, + funcs, paint, paint->palette, paint->foreground); + + hb_paint_pop_transform (funcs, paint); return ret; } diff --git a/src/hb-raster-paint.hh b/src/hb-raster-paint.hh index 0ff79be7a..be7429ebe 100644 --- a/src/hb-raster-paint.hh +++ b/src/hb-raster-paint.hh @@ -193,8 +193,10 @@ struct hb_raster_paint_t return clip_stack.tail (); } - hb_transform_t<> ¤t_transform () + hb_transform_t<> current_transform () { + if (unlikely (!transform_stack.length)) + return {1, 0, 0, 1, 0, 0}; return transform_stack.tail (); }