| Index: cc/base/math_util.cc
|
| diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc
|
| index 919a172f199d026957e6f978acd63a9845615bc4..1f7de66527697ac14dbdfff7827efc1e0afb5fc0 100644
|
| --- a/cc/base/math_util.cc
|
| +++ b/cc/base/math_util.cc
|
| @@ -108,15 +108,15 @@ gfx::Rect MathUtil::MapClippedRect(const gfx::Transform& transform,
|
|
|
| gfx::RectF MathUtil::MapClippedRect(const gfx::Transform& transform,
|
| const gfx::RectF& src_rect) {
|
| - if (transform.IsIdentityOrTranslation())
|
| + if (transform.IsIdentityOrTranslation()) {
|
| return src_rect +
|
| - gfx::Vector2dF(
|
| - static_cast<float>(transform.matrix().getDouble(0, 3)),
|
| - static_cast<float>(transform.matrix().getDouble(1, 3)));
|
| + gfx::Vector2dF(SkMScalarToFloat(transform.matrix().get(0, 3)),
|
| + SkMScalarToFloat(transform.matrix().get(1, 3)));
|
| + }
|
|
|
| // Apply the transform, but retain the result in homogeneous coordinates.
|
|
|
| - double quad[4 * 2]; // input: 4 x 2D points
|
| + SkMScalar quad[4 * 2]; // input: 4 x 2D points
|
| quad[0] = src_rect.x();
|
| quad[1] = src_rect.y();
|
| quad[2] = src_rect.right();
|
| @@ -126,7 +126,7 @@ gfx::RectF MathUtil::MapClippedRect(const gfx::Transform& transform,
|
| quad[6] = src_rect.x();
|
| quad[7] = src_rect.bottom();
|
|
|
| - double result[4 * 4]; // output: 4 x 4D homogeneous points
|
| + SkMScalar result[4 * 4]; // output: 4 x 4D homogeneous points
|
| transform.matrix().map2(quad, 4, result);
|
|
|
| HomogeneousCoordinate hc0(result[0], result[1], result[2], result[3]);
|
| @@ -140,9 +140,8 @@ gfx::RectF MathUtil::ProjectClippedRect(const gfx::Transform& transform,
|
| const gfx::RectF& src_rect) {
|
| if (transform.IsIdentityOrTranslation()) {
|
| return src_rect +
|
| - gfx::Vector2dF(
|
| - static_cast<float>(transform.matrix().getDouble(0, 3)),
|
| - static_cast<float>(transform.matrix().getDouble(1, 3)));
|
| + gfx::Vector2dF(SkMScalarToFloat(transform.matrix().get(0, 3)),
|
| + SkMScalarToFloat(transform.matrix().get(1, 3)));
|
| }
|
|
|
| // Perform the projection, but retain the result in homogeneous coordinates.
|
| @@ -330,8 +329,8 @@ gfx::QuadF MathUtil::MapQuad(const gfx::Transform& transform,
|
| if (transform.IsIdentityOrTranslation()) {
|
| gfx::QuadF mapped_quad(q);
|
| mapped_quad +=
|
| - gfx::Vector2dF(static_cast<float>(transform.matrix().getDouble(0, 3)),
|
| - static_cast<float>(transform.matrix().getDouble(1, 3)));
|
| + gfx::Vector2dF(SkMScalarToFloat(transform.matrix().get(0, 3)),
|
| + SkMScalarToFloat(transform.matrix().get(1, 3)));
|
| *clipped = false;
|
| return mapped_quad;
|
| }
|
| @@ -466,7 +465,7 @@ gfx::RectF MathUtil::ScaleRectProportional(const gfx::RectF& input_outer_rect,
|
| return output_inner_rect;
|
| }
|
|
|
| -static inline float ScaleOnAxis(double a, double b, double c) {
|
| +static inline SkMScalar ScaleOnAxis(SkMScalar a, SkMScalar b, SkMScalar c) {
|
| return std::sqrt(a * a + b * b + c * c);
|
| }
|
|
|
| @@ -475,13 +474,13 @@ gfx::Vector2dF MathUtil::ComputeTransform2dScaleComponents(
|
| float fallback_value) {
|
| if (transform.HasPerspective())
|
| return gfx::Vector2dF(fallback_value, fallback_value);
|
| - float x_scale = ScaleOnAxis(transform.matrix().getDouble(0, 0),
|
| - transform.matrix().getDouble(1, 0),
|
| - transform.matrix().getDouble(2, 0));
|
| - float y_scale = ScaleOnAxis(transform.matrix().getDouble(0, 1),
|
| - transform.matrix().getDouble(1, 1),
|
| - transform.matrix().getDouble(2, 1));
|
| - return gfx::Vector2dF(x_scale, y_scale);
|
| + SkMScalar x_scale = ScaleOnAxis(transform.matrix().get(0, 0),
|
| + transform.matrix().get(1, 0),
|
| + transform.matrix().get(2, 0));
|
| + SkMScalar y_scale = ScaleOnAxis(transform.matrix().get(0, 1),
|
| + transform.matrix().get(1, 1),
|
| + transform.matrix().get(2, 1));
|
| + return gfx::Vector2dF(SkMScalarToFloat(x_scale), SkMScalarToFloat(y_scale));
|
| }
|
|
|
| float MathUtil::SmallestAngleBetweenVectors(gfx::Vector2dF v1,
|
|
|