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

Unified Diff: cc/math_util.h

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to tip of tree and addressed 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: cc/math_util.h
diff --git a/cc/math_util.h b/cc/math_util.h
index db43aed6ba9f4e547b1227b6d9085698e518fbb3..f5735cf758c0a6875a59a63db1004767021451d4 100644
--- a/cc/math_util.h
+++ b/cc/math_util.h
@@ -11,14 +11,11 @@
#include "ui/gfx/point3_f.h"
#include "ui/gfx/transform.h"
-namespace WebKit {
-class WebTransformationMatrix;
-}
-
namespace gfx {
class QuadF;
class Rect;
class RectF;
+class Transform;
class Vector2dF;
}
@@ -78,7 +75,7 @@ public:
static float Deg2Rad(float deg) { return deg * PI_FLOAT / 180; }
static float Rad2Deg(float rad) { return rad * 180 / PI_FLOAT; }
- // Background: WebTransformationMatrix code in WebCore does not do the right thing in
+ // Background: Transform code in WebCore does not do the right thing in
danakj 2012/11/24 02:34:54 Guess this comment is now a bit out of date.
// mapRect / mapQuad / projectQuad when there is a perspective projection that causes
// one of the transformed vertices to go to w < 0. In those cases, it is necessary to
// perform clipping in homogeneous coordinates, after applying the transform, before
@@ -86,30 +83,30 @@ public:
//
// These functions return the axis-aligned rect that encloses the correctly clipped,
// transformed polygon.
- static gfx::Rect mapClippedRect(const WebKit::WebTransformationMatrix&, const gfx::Rect&);
- static gfx::RectF mapClippedRect(const WebKit::WebTransformationMatrix&, const gfx::RectF&);
- static gfx::RectF projectClippedRect(const WebKit::WebTransformationMatrix&, const gfx::RectF&);
+ static gfx::Rect mapClippedRect(const gfx::Transform&, const gfx::Rect&);
+ static gfx::RectF mapClippedRect(const gfx::Transform&, const gfx::RectF&);
+ static gfx::RectF projectClippedRect(const gfx::Transform&, const gfx::RectF&);
// Returns an array of vertices that represent the clipped polygon. After returning, indexes from
// 0 to numVerticesInClippedQuad are valid in the clippedQuad array. Note that
// numVerticesInClippedQuad may be zero, which means the entire quad was clipped, and
// none of the vertices in the array are valid.
- static void mapClippedQuad(const WebKit::WebTransformationMatrix&, const gfx::QuadF& srcQuad, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad);
+ static void mapClippedQuad(const gfx::Transform&, const gfx::QuadF& srcQuad, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad);
static gfx::RectF computeEnclosingRectOfVertices(gfx::PointF vertices[], int numVertices);
static gfx::RectF computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4);
// NOTE: These functions do not do correct clipping against w = 0 plane, but they
// correctly detect the clipped condition via the boolean clipped.
- static gfx::QuadF mapQuad(const WebKit::WebTransformationMatrix&, const gfx::QuadF&, bool& clipped);
- static gfx::PointF mapPoint(const WebKit::WebTransformationMatrix&, const gfx::PointF&, bool& clipped);
- static gfx::Point3F mapPoint(const WebKit::WebTransformationMatrix&, const gfx::Point3F&, bool& clipped);
- static gfx::QuadF projectQuad(const WebKit::WebTransformationMatrix&, const gfx::QuadF&, bool& clipped);
- static gfx::PointF projectPoint(const WebKit::WebTransformationMatrix&, const gfx::PointF&, bool& clipped);
+ static gfx::QuadF mapQuad(const gfx::Transform&, const gfx::QuadF&, bool& clipped);
+ static gfx::PointF mapPoint(const gfx::Transform&, const gfx::PointF&, bool& clipped);
+ static gfx::Point3F mapPoint(const gfx::Transform&, const gfx::Point3F&, bool& clipped);
+ static gfx::QuadF projectQuad(const gfx::Transform&, const gfx::QuadF&, bool& clipped);
+ static gfx::PointF projectPoint(const gfx::Transform&, const gfx::PointF&, bool& clipped);
- static void flattenTransformTo2d(WebKit::WebTransformationMatrix&);
+ static void flattenTransformTo2d(gfx::Transform&);
- static gfx::Vector2dF computeTransform2dScaleComponents(const WebKit::WebTransformationMatrix&);
+ static gfx::Vector2dF computeTransform2dScaleComponents(const gfx::Transform&);
// Returns the smallest angle between the given two vectors in degrees. Neither vector is
// assumed to be normalized.
@@ -118,17 +115,14 @@ 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
+ // Temporary API to ease migration from gfx::Transform
danakj 2012/11/24 02:34:54 Heh, undo the change on this line.
// 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*);
static void rotateEulerAngles(gfx::Transform*, double eulerX, double eulerY, double eulerZ);
static void rotateAxisAngle(gfx::Transform*, double i, double j, double k, double degrees);
static gfx::Transform inverse(const gfx::Transform&);

Powered by Google App Engine
This is Rietveld 408576698