Index: cc/animation/transform_operation.cc |
diff --git a/cc/animation/transform_operation.cc b/cc/animation/transform_operation.cc |
index b4e6917cefcd9e170572ad80fcb2499498d684a1..5140722d728a10e59ccaa89197c40d0a7dc88600 100644 |
--- a/cc/animation/transform_operation.cc |
+++ b/cc/animation/transform_operation.cc |
@@ -24,24 +24,26 @@ static bool IsOperationIdentity(const TransformOperation* operation) { |
static bool ShareSameAxis(const TransformOperation* from, |
const TransformOperation* to, |
- double& axis_x, double& axis_y, double& axis_z, |
- double& angle_from) { |
+ double* axis_x, |
+ double* axis_y, |
+ double* axis_z, |
+ double* angle_from) { |
if (IsOperationIdentity(from) && IsOperationIdentity(to)) |
return false; |
if (IsOperationIdentity(from) && !IsOperationIdentity(to)) { |
- axis_x = to->rotate.axis.x; |
- axis_y = to->rotate.axis.y; |
- axis_z = to->rotate.axis.z; |
- angle_from = 0; |
+ *axis_x = to->rotate.axis.x; |
+ *axis_y = to->rotate.axis.y; |
+ *axis_z = to->rotate.axis.z; |
+ *angle_from = 0; |
return true; |
} |
if (!IsOperationIdentity(from) && IsOperationIdentity(to)) { |
- axis_x = from->rotate.axis.x; |
- axis_y = from->rotate.axis.y; |
- axis_z = from->rotate.axis.z; |
- angle_from = from->rotate.angle; |
+ *axis_x = from->rotate.axis.x; |
+ *axis_y = from->rotate.axis.y; |
+ *axis_z = from->rotate.axis.z; |
+ *angle_from = from->rotate.angle; |
return true; |
} |
@@ -61,12 +63,12 @@ static bool ShareSameAxis(const TransformOperation* from, |
double error = std::fabs(1.0 - (dot * dot) / (length_2 * other_length_2)); |
bool result = error < kAngleEpsilon; |
if (result) { |
- axis_x = to->rotate.axis.x; |
- axis_y = to->rotate.axis.y; |
- axis_z = to->rotate.axis.z; |
+ *axis_x = to->rotate.axis.x; |
+ *axis_y = to->rotate.axis.y; |
+ *axis_z = to->rotate.axis.z; |
// If the axes are pointing in opposite directions, we need to reverse |
// the angle. |
- angle_from = dot > 0 ? from->rotate.angle : -from->rotate.angle; |
+ *angle_from = dot > 0 ? from->rotate.angle : -from->rotate.angle; |
} |
return result; |
} |
@@ -85,7 +87,7 @@ bool TransformOperation::BlendTransformOperations( |
const TransformOperation* from, |
const TransformOperation* to, |
double progress, |
- gfx::Transform& result) { |
+ gfx::Transform* result) { |
if (IsOperationIdentity(from) && IsOperationIdentity(to)) |
return true; |
@@ -104,9 +106,9 @@ 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), |
- BlendDoubles(from_y, to_y, progress), |
- BlendDoubles(from_z, to_z, progress)); |
+ result->Translate3d(BlendDoubles(from_x, to_x, progress), |
+ BlendDoubles(from_y, to_y, progress), |
+ BlendDoubles(from_z, to_z, progress)); |
break; |
} |
case TransformOperation::TransformOperationRotate: { |
@@ -115,18 +117,18 @@ bool TransformOperation::BlendTransformOperations( |
double axis_z = 1; |
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.RotateAbout(gfx::Vector3dF(axis_x, axis_y, axis_z), |
- BlendDoubles(from_angle, to_angle, progress)); |
- } else { |
+ if (ShareSameAxis(from, to, &axis_x, &axis_y, &axis_z, &from_angle)) |
+ result->RotateAbout(gfx::Vector3dF(axis_x, axis_y, axis_z), |
+ BlendDoubles(from_angle, to_angle, progress)); |
+ else { |
gfx::Transform to_matrix; |
if (!IsOperationIdentity(to)) |
to_matrix = to->matrix; |
gfx::Transform from_matrix; |
if (!IsOperationIdentity(from)) |
from_matrix = from->matrix; |
- result = to_matrix; |
- if (!result.Blend(from_matrix, progress)) |
+ *result = to_matrix; |
+ if (!result->Blend(from_matrix, progress)) |
return false; |
} |
break; |
@@ -138,9 +140,9 @@ 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), |
- BlendDoubles(from_y, to_y, progress), |
- BlendDoubles(from_z, to_z, progress)); |
+ result->Scale3d(BlendDoubles(from_x, to_x, progress), |
+ BlendDoubles(from_y, to_y, progress), |
+ BlendDoubles(from_z, to_z, progress)); |
break; |
} |
case TransformOperation::TransformOperationSkew: { |
@@ -148,8 +150,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: { |
@@ -157,7 +159,7 @@ 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.ApplyPerspectiveDepth( |
+ result->ApplyPerspectiveDepth( |
BlendDoubles(from_perspective_depth, to_perspective_depth, progress)); |
break; |
} |
@@ -168,8 +170,8 @@ bool TransformOperation::BlendTransformOperations( |
gfx::Transform from_matrix; |
if (!IsOperationIdentity(from)) |
from_matrix = from->matrix; |
- result = to_matrix; |
- if (!result.Blend(from_matrix, progress)) |
+ *result = to_matrix; |
+ if (!result->Blend(from_matrix, progress)) |
return false; |
break; |
} |