Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Unified Diff: ui/gfx/transform.h

Issue 11418197: Move temporary MathUtil wrappers to permanent home in gfx::Transform (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased and addressed reviewer feedback Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/transform.h
diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h
index 52d15cfb22fe54a4208e76828df69ac2f0078e12..cccbe722410bb8b5fd612e2c15bb2a9e9f09e6d6 100644
--- a/ui/gfx/transform.h
+++ b/ui/gfx/transform.h
@@ -29,13 +29,16 @@ class UI_EXPORT Transform {
// Resets this transform to the identity transform.
void MakeIdentity();
- // Applies the current transformation on a rotation and assigns the result
+ // Applies the current transformation on a 2d rotation and assigns the result
// to |this|.
- void Rotate(double degree);
+ void Rotate(double degrees) { RotateAboutZAxis(degrees); }
// Applies the current transformation on an axis-angle rotation and assigns
// the result to |this|.
- void RotateAbout(const Vector3dF& point, double degree);
+ void RotateAboutXAxis(double degrees);
+ void RotateAboutYAxis(double degrees);
+ void RotateAboutZAxis(double degrees);
+ void RotateAbout(const Vector3dF& axis, double degrees);
// Applies the current transformation on a scaling and assigns the result
// to |this|.
@@ -67,9 +70,23 @@ class UI_EXPORT Transform {
// Returns true if this is the identity matrix.
bool IsIdentity() const;
+ // Returns true if the matrix is either identity or pure translation.
+ bool IsIdentityOrTranslation() const;
+
+ // Returns true if the matrix is has only scaling and translation components.
+ bool IsScaleOrTranslation() const;
+
+ // Returns true if the matrix has any perspective component that would
+ // change the w-component of a homogeneous point.
+ bool HasPerspective() const;
+
// Returns true if this transform is non-singular.
bool IsInvertible() const;
+ // Returns true if a layer with a forward-facing normal of (0, 0, 1) would
+ // have its back side facing frontwards after applying the transform.
+ bool IsBackFaceVisible() const;
+
// Inverts the transform which is passed in. Returns true if successful.
bool GetInverse(Transform* transform) const WARN_UNUSED_RESULT;

Powered by Google App Engine
This is Rietveld 408576698