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

Unified Diff: cc/math_util.h

Issue 11316043: Implement unit tests and temporary MathUtil wrappers for transform functionality (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | cc/math_util.cc » ('j') | cc/math_util.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/math_util.h
diff --git a/cc/math_util.h b/cc/math_util.h
index fe1780042800f53800b9e8b1a19f2b2daf782644..0f892a4e86416e6cc758246b02de8209f01eada7 100644
--- a/cc/math_util.h
+++ b/cc/math_util.h
@@ -9,6 +9,7 @@
#include "cc/cc_export.h"
#include "ui/gfx/point_f.h"
#include "ui/gfx/point3_f.h"
+#include "ui/gfx/transform.h"
namespace WebKit {
class WebTransformationMatrix;
@@ -115,8 +116,37 @@ public:
// Projects the |source| vector onto |destination|. Neither vector is assumed to be normalized.
static gfx::Vector2dF projectVector(gfx::Vector2dF source, gfx::Vector2dF destination);
+
+ // Temporary API to ease migration from WebKit::WebTransformationMatrix
+ // to gfx::Transform.
+ //
+ // TODO(shawnsingh, vollick) we should phase out as much as possible of
+ // these temporary functions, putting functionality into gfx::Transform.
+ static bool isInvertible(const gfx::Transform&);
+ static bool isBackFaceVisible(const gfx::Transform&);
+ static bool isIdentity(const gfx::Transform&);
+ static bool isIdentityOrTranslation(const gfx::Transform&);
+ static bool hasPerspective(const gfx::Transform&);
+ static void makeIdentity(gfx::Transform*);
Ian Vollick 2012/11/16 13:44:46 Would transform = gfx::Transform() suffice?
danakj 2012/11/16 16:25:15 I've seen a pattern in the existing classes to pro
+ static void rotateEulerAngles(gfx::Transform*, float eulerX, float eulerY, float eulerZ); // TODO: verify old webcore API was euler angles?
Ian Vollick 2012/11/16 13:44:46 These should be doubles now that gfx::Transform is
+ static void rotateAxisAngle(gfx::Transform*, float i, float j, float k, float degrees);
+ static gfx::Transform inverse(const gfx::Transform&);
Ian Vollick 2012/11/16 13:44:46 I think this should be pulled from the API. gfx::T
shawnsingh 2012/11/17 00:38:31 As mentioned above, I agree with this, but I would
+ static gfx::Transform to2dTransform(const gfx::Transform&);
+ static gfx::Transform toGfxTransform(const WebKit::WebTransformationMatrix&);
+ // Note carefully: the args here are labeled as per Webcore indexing conventions.
+ static gfx::Transform createGfxTransform(float m11, float m12, float m13, float m14,
+ float m21, float m22, float m23, float m24,
+ float m31, float m32, float m33, float m34,
+ float m41, float m42, float m43, float m44);
Ian Vollick 2012/11/16 13:44:46 This is a bit of a matter of preference, but I pre
shawnsingh 2012/11/17 00:38:31 Same goes for this comment - this wrapper simply e
+
+ static gfx::Transform createGfxTransform(float a, float b, float c,
+ float d, float e, float f);
};
+// TODO(shawnsingh, vollick) this is a temporary home, should eventually
+// be phased out in favor of gfx::Transform API.
+gfx::Transform operator*(const gfx::Transform&, const gfx::Transform&);
+
} // namespace cc
#endif // CC_MATH_UTIL_H_
« no previous file with comments | « no previous file | cc/math_util.cc » ('j') | cc/math_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698