mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibGfx: Add fast path for multiply() with identity transforms
This is a no-op, and exiting early is useful as it cuts time spent in AffineTransform::multiply() from 3% to 2% when hovering links on ziglang.org.
This commit is contained in:
parent
e46deec846
commit
c69b266e43
Notes:
sideshowbarker
2024-07-17 02:56:25 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c69b266e43 Pull-request: https://github.com/SerenityOS/serenity/pull/23423
1 changed files with 2 additions and 0 deletions
|
@ -108,6 +108,8 @@ AffineTransform& AffineTransform::set_translation(FloatPoint t)
|
|||
|
||||
AffineTransform& AffineTransform::multiply(AffineTransform const& other)
|
||||
{
|
||||
if (other.is_identity())
|
||||
return *this;
|
||||
AffineTransform result;
|
||||
result.m_values[0] = other.a() * a() + other.b() * c();
|
||||
result.m_values[1] = other.a() * b() + other.b() * d();
|
||||
|
|
Loading…
Reference in a new issue