mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 11:39:44 +03:00
LibGfx: Add AffineTransform::is_identity_or_translation()
This will allow us to implement fast paths in cases where a simple translation can be handled faster than a full affine transform.
This commit is contained in:
parent
adc92beed1
commit
b4c3882d9c
Notes:
sideshowbarker
2024-07-17 12:08:04 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/b4c3882d9c
@ -16,6 +16,11 @@ bool AffineTransform::is_identity() const
|
||||
return m_values[0] == 1 && m_values[1] == 0 && m_values[2] == 0 && m_values[3] == 1 && m_values[4] == 0 && m_values[5] == 0;
|
||||
}
|
||||
|
||||
bool AffineTransform::is_identity_or_translation() const
|
||||
{
|
||||
return a() == 1 && b() == 0 && c() == 0 && d() == 1;
|
||||
}
|
||||
|
||||
static float hypotenuse(float x, float y)
|
||||
{
|
||||
// FIXME: This won't handle overflow :(
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
}
|
||||
|
||||
bool is_identity() const;
|
||||
bool is_identity_or_translation() const;
|
||||
|
||||
void map(float unmapped_x, float unmapped_y, float& mapped_x, float& mapped_y) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user