1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08:07:44 +00:00

LibGfx: Add fast path to AA line drawing with simple 2D transform

If the effective 2D transform is just a basic translation, we now simply
translate the underlying painter before & after drawing AA lines.

This avoids all the extra math that otherwise has to happen when mapping
points through an affine transform.

This noticeably increase "mousing around" performance on Wikipedia. :^)
This commit is contained in:
Andreas Kling 2022-04-10 18:41:24 +02:00
parent b4c3882d9c
commit 908d42d0ba
2 changed files with 31 additions and 8 deletions

View file

@ -37,8 +37,8 @@ private:
OnlyEnds,
Full,
};
template<AntiAliasPolicy policy>
void draw_anti_aliased_line(FloatPoint const&, FloatPoint const&, Color, float thickness, Painter::LineStyle style, Color alternate_color);
template<AntiAliasPolicy policy, typename TransformPoint>
void draw_anti_aliased_line(FloatPoint const&, FloatPoint const&, Color, float thickness, Painter::LineStyle style, Color alternate_color, TransformPoint);
Painter& m_underlying_painter;
AffineTransform m_transform;