summaryrefslogtreecommitdiffstats
path: root/cc/base
diff options
context:
space:
mode:
authorhalliwell <halliwell@chromium.org>2015-05-13 14:58:43 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-13 21:59:00 +0000
commitaa11128275a38f5161a65de0cd5affb31856330d (patch)
tree66dd57a08b69e7aab97fb9431050aedf2c08550d /cc/base
parent7862c2537ff491d5865a451b3f9f96bb7c2f3483 (diff)
downloadchromium_src-aa11128275a38f5161a65de0cd5affb31856330d.zip
chromium_src-aa11128275a38f5161a65de0cd5affb31856330d.tar.gz
chromium_src-aa11128275a38f5161a65de0cd5affb31856330d.tar.bz2
Add detection for rotation and flip overlay transforms
Rotations and flips were listed in the enum, but not being allowed by OverlayCandidate::GetOverlayTransform. BUG= Review URL: https://codereview.chromium.org/1135813005 Cr-Commit-Position: refs/heads/master@{#329719}
Diffstat (limited to 'cc/base')
-rw-r--r--cc/base/math_util.cc13
-rw-r--r--cc/base/math_util.h7
2 files changed, 20 insertions, 0 deletions
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc
index e2fd565..969e52a 100644
--- a/cc/base/math_util.cc
+++ b/cc/base/math_util.cc
@@ -15,6 +15,7 @@
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/vector2d_f.h"
+#include "ui/gfx/geometry/vector3d_f.h"
#include "ui/gfx/transform.h"
namespace cc {
@@ -867,4 +868,16 @@ float MathUtil::AsFloatSafely(float value) {
return std::min(value, std::numeric_limits<float>::max());
}
+gfx::Vector3dF MathUtil::GetXAxis(const gfx::Transform& transform) {
+ return gfx::Vector3dF(transform.matrix().getFloat(0, 0),
+ transform.matrix().getFloat(1, 0),
+ transform.matrix().getFloat(2, 0));
+}
+
+gfx::Vector3dF MathUtil::GetYAxis(const gfx::Transform& transform) {
+ return gfx::Vector3dF(transform.matrix().getFloat(0, 1),
+ transform.matrix().getFloat(1, 1),
+ transform.matrix().getFloat(2, 1));
+}
+
} // namespace cc
diff --git a/cc/base/math_util.h b/cc/base/math_util.h
index 56fdd17..749b9bd 100644
--- a/cc/base/math_util.h
+++ b/cc/base/math_util.h
@@ -33,6 +33,7 @@ class RectF;
class Transform;
class Vector2dF;
class Vector2d;
+class Vector3dF;
}
namespace cc {
@@ -240,6 +241,12 @@ class CC_EXPORT MathUtil {
// If the value is inf, returns max double/float representation.
static double AsDoubleSafely(double value);
static float AsFloatSafely(float value);
+
+ // Returns vector that x axis (1,0,0) transforms to under given transform.
+ static gfx::Vector3dF GetXAxis(const gfx::Transform& transform);
+
+ // Returns vector that y axis (0,1,0) transforms to under given transform.
+ static gfx::Vector3dF GetYAxis(const gfx::Transform& transform);
};
} // namespace cc