1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:17:35 +00:00

LibGfx: Fix affine transformations in TrueType composite glyphs

This fixes an issue where, when looping over the components of a
composite glyph, we used to mutate the affine transformation of the
glyph itself when computing the transformations of its components.

(AffineTransform::multiply() is non-const).
This commit is contained in:
Itamar 2022-09-24 16:33:56 +03:00 committed by Andreas Kling
parent 13e9947b4b
commit 7165dbce5c

View file

@ -105,7 +105,7 @@ public:
RefPtr<Gfx::Bitmap> rasterize_simple(i16 ascender, i16 descender, float x_scale, float y_scale) const; RefPtr<Gfx::Bitmap> rasterize_simple(i16 ascender, i16 descender, float x_scale, float y_scale) const;
template<typename GlyphCb> template<typename GlyphCb>
void rasterize_composite_loop(Rasterizer& rasterizer, Gfx::AffineTransform& transform, GlyphCb glyph_callback) const void rasterize_composite_loop(Rasterizer& rasterizer, Gfx::AffineTransform const& transform, GlyphCb glyph_callback) const
{ {
ComponentIterator component_iterator(m_slice); ComponentIterator component_iterator(m_slice);
@ -115,7 +115,8 @@ public:
break; break;
} }
auto item = opt_item.value(); auto item = opt_item.value();
auto affine_here = transform.multiply(item.affine); Gfx::AffineTransform affine_here { transform };
affine_here.multiply(item.affine);
Glyph glyph = glyph_callback(item.glyph_id); Glyph glyph = glyph_callback(item.glyph_id);
if (glyph.m_type == Type::Simple) { if (glyph.m_type == Type::Simple) {