mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
LibGfx: Inline some AffineTransform functions
Asking if an AffineTransform is identity or translate-only can be done inline and avoid the cost of a function call in tight loops.
This commit is contained in:
parent
2dacd1252c
commit
e46deec846
2 changed files with 9 additions and 12 deletions
|
@ -12,16 +12,6 @@
|
|||
|
||||
namespace Gfx {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
float AffineTransform::x_scale() const
|
||||
{
|
||||
return AK::hypot(m_values[0], m_values[1]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue