diff --git a/headers/os/interface/AffineTransform.h b/headers/os/interface/AffineTransform.h index 516d473442..b84dee957d 100644 --- a/headers/os/interface/AffineTransform.h +++ b/headers/os/interface/AffineTransform.h @@ -171,6 +171,8 @@ public: = kDefaultEpsilon) const; bool IsIdentity(double epsilon = kDefaultEpsilon) const; + bool IsDilation(double epsilon + = kDefaultEpsilon) const; bool IsEqual(const BAffineTransform& other, double epsilon = kDefaultEpsilon) const; diff --git a/src/kits/interface/AffineTransform.cpp b/src/kits/interface/AffineTransform.cpp index e0360b3536..149435dda1 100644 --- a/src/kits/interface/AffineTransform.cpp +++ b/src/kits/interface/AffineTransform.cpp @@ -513,6 +513,14 @@ BAffineTransform::IsIdentity(double epsilon) const } +bool +BAffineTransform::IsDilation(double epsilon) const +{ + return IsEqualEpsilon(shy, 0.0, epsilon) + && IsEqualEpsilon(shx, 0.0, epsilon); +} + + bool BAffineTransform::IsEqual(const BAffineTransform& other, double epsilon) const { diff --git a/src/servers/app/drawing/Painter/Transformable.cpp b/src/servers/app/drawing/Painter/Transformable.cpp index ca7eb66792..0ffc9b1800 100644 --- a/src/servers/app/drawing/Painter/Transformable.cpp +++ b/src/servers/app/drawing/Painter/Transformable.cpp @@ -169,6 +169,15 @@ Transformable::IsIdentity() const } +bool +Transformable::IsDilation() const +{ + double m[6]; + store_to(m); + return m[1] == 0.0 && m[2] == 0.0; +} + + void Transformable::Transform(double* x, double* y) const { diff --git a/src/servers/app/drawing/Painter/Transformable.h b/src/servers/app/drawing/Painter/Transformable.h index ac8dc0b96c..ab40ae1728 100644 --- a/src/servers/app/drawing/Painter/Transformable.h +++ b/src/servers/app/drawing/Painter/Transformable.h @@ -38,6 +38,7 @@ class Transformable : public BArchivable, void Reset(); bool IsIdentity() const; + bool IsDilation() const; // bool operator==(const Transformable& other) const; // bool operator!=(const Transformable& other) const;