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

Unified Diff: cc/transform_operation.cc

Issue 12035029: Finish migrating cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix nits Created 7 years, 11 months 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 | « cc/transform_operation.h ('k') | cc/transform_operations.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/transform_operation.cc
diff --git a/cc/transform_operation.cc b/cc/transform_operation.cc
index 7ca81a3ec32e820d457ba1428a50160e7a26d8e1..2c3b632f28c25a6a801050aecc122e7ece8dc70a 100644
--- a/cc/transform_operation.cc
+++ b/cc/transform_operation.cc
@@ -6,8 +6,7 @@
#include <limits>
#include "cc/transform_operation.h"
-
-using WebKit::WebTransformationMatrix;
+#include "ui/gfx/vector3d_f.h"
namespace {
const double kAngleEpsilon = 1e-4;
@@ -16,7 +15,7 @@ const double kAngleEpsilon = 1e-4;
namespace cc {
bool TransformOperation::IsIdentity() const {
- return matrix.isIdentity();
+ return matrix.IsIdentity();
}
static bool IsOperationIdentity(const TransformOperation* operation) {
@@ -73,6 +72,12 @@ static bool ShareSameAxis(const TransformOperation* from,
}
static double BlendDoubles(double from, double to, double progress) {
+ if (progress <= 0.0)
+ return from;
+
+ if (progress >= 1.0)
+ return to;
+
return from * (1 - progress) + to * progress;
}
@@ -80,7 +85,7 @@ bool TransformOperation::BlendTransformOperations(
const TransformOperation* from,
const TransformOperation* to,
double progress,
- WebTransformationMatrix& result) {
+ gfx::Transform& result) {
if (IsOperationIdentity(from) && IsOperationIdentity(to))
return true;
@@ -99,7 +104,7 @@ bool TransformOperation::BlendTransformOperations(
double to_x = IsOperationIdentity(to) ? 0 : to->translate.x;
double to_y = IsOperationIdentity(to) ? 0 : to->translate.y;
double to_z = IsOperationIdentity(to) ? 0 : to->translate.z;
- result.translate3d(BlendDoubles(from_x, to_x, progress),
+ result.Translate3d(BlendDoubles(from_x, to_x, progress),
BlendDoubles(from_y, to_y, progress),
BlendDoubles(from_z, to_z, progress));
break;
@@ -111,17 +116,17 @@ bool TransformOperation::BlendTransformOperations(
double from_angle = 0;
double to_angle = IsOperationIdentity(to) ? 0 : to->rotate.angle;
if (ShareSameAxis(from, to, axis_x, axis_y, axis_z, from_angle))
- result.rotate3d(axis_x, axis_y, axis_z,
- BlendDoubles(from_angle, to_angle, progress));
+ result.RotateAbout(gfx::Vector3dF(axis_x, axis_y, axis_z),
+ BlendDoubles(from_angle, to_angle, progress));
else {
- WebTransformationMatrix to_matrix;
+ gfx::Transform to_matrix;
if (!IsOperationIdentity(to))
to_matrix = to->matrix;
- WebTransformationMatrix from_matrix;
+ gfx::Transform from_matrix;
if (!IsOperationIdentity(from))
from_matrix = from->matrix;
result = to_matrix;
- if (!result.blend(from_matrix, progress))
+ if (!result.Blend(from_matrix, progress))
return false;
}
break;
@@ -133,7 +138,7 @@ bool TransformOperation::BlendTransformOperations(
double to_x = IsOperationIdentity(to) ? 1 : to->scale.x;
double to_y = IsOperationIdentity(to) ? 1 : to->scale.y;
double to_z = IsOperationIdentity(to) ? 1 : to->scale.z;
- result.scale3d(BlendDoubles(from_x, to_x, progress),
+ result.Scale3d(BlendDoubles(from_x, to_x, progress),
BlendDoubles(from_y, to_y, progress),
BlendDoubles(from_z, to_z, progress));
break;
@@ -143,8 +148,8 @@ bool TransformOperation::BlendTransformOperations(
double from_y = IsOperationIdentity(from) ? 0 : from->skew.y;
double to_x = IsOperationIdentity(to) ? 0 : to->skew.x;
double to_y = IsOperationIdentity(to) ? 0 : to->skew.y;
- result.skewX(BlendDoubles(from_x, to_x, progress));
- result.skewY(BlendDoubles(from_y, to_y, progress));
+ result.SkewX(BlendDoubles(from_x, to_x, progress));
+ result.SkewY(BlendDoubles(from_y, to_y, progress));
break;
}
case TransformOperation::TransformOperationPerspective: {
@@ -152,19 +157,19 @@ bool TransformOperation::BlendTransformOperations(
std::numeric_limits<double>::max() : from->perspective_depth;
double to_perspective_depth = IsOperationIdentity(to) ?
std::numeric_limits<double>::max() : to->perspective_depth;
- result.applyPerspective(
+ result.ApplyPerspectiveDepth(
BlendDoubles(from_perspective_depth, to_perspective_depth, progress));
break;
}
case TransformOperation::TransformOperationMatrix: {
- WebTransformationMatrix to_matrix;
+ gfx::Transform to_matrix;
if (!IsOperationIdentity(to))
to_matrix = to->matrix;
- WebTransformationMatrix from_matrix;
+ gfx::Transform from_matrix;
if (!IsOperationIdentity(from))
from_matrix = from->matrix;
result = to_matrix;
- if (!result.blend(from_matrix, progress))
+ if (!result.Blend(from_matrix, progress))
return false;
break;
}
« no previous file with comments | « cc/transform_operation.h ('k') | cc/transform_operations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698