summaryrefslogtreecommitdiff
path: root/chromium/cc/base/math_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/cc/base/math_util.h')
-rw-r--r--chromium/cc/base/math_util.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/chromium/cc/base/math_util.h b/chromium/cc/base/math_util.h
index 37f0c07602f..7912f8a8a25 100644
--- a/chromium/cc/base/math_util.h
+++ b/chromium/cc/base/math_util.h
@@ -45,7 +45,7 @@ struct HomogeneousCoordinate {
// For now, because this code is used privately only by MathUtil, it should
// never be called when w == 0, and we do not yet need to handle that case.
DCHECK(w());
- double inv_w = 1.0 / w();
+ SkMScalar inv_w = 1.0 / w();
return gfx::PointF(x() * inv_w, y() * inv_w);
}
@@ -56,7 +56,7 @@ struct HomogeneousCoordinate {
// For now, because this code is used privately only by MathUtil, it should
// never be called when w == 0, and we do not yet need to handle that case.
DCHECK(w());
- double inv_w = 1.0 / w();
+ SkMScalar inv_w = 1.0 / w();
return gfx::Point3F(x() * inv_w, y() * inv_w, z() * inv_w);
}
@@ -144,6 +144,15 @@ class CC_EXPORT MathUtil {
static gfx::Vector2dF ComputeTransform2dScaleComponents(const gfx::Transform&,
float fallbackValue);
+ // Makes a rect that has the same relationship to input_outer_rect as
+ // scale_inner_rect has to scale_outer_rect. scale_inner_rect should be
+ // contained within scale_outer_rect, and likewise the rectangle that is
+ // returned will be within input_outer_rect at a similar relative, scaled
+ // position.
+ static gfx::RectF ScaleRectProportional(const gfx::RectF& input_outer_rect,
+ const gfx::RectF& scale_outer_rect,
+ const gfx::RectF& scale_inner_rect);
+
// Returns the smallest angle between the given two vectors in degrees.
// Neither vector is assumed to be normalized.
static float SmallestAngleBetweenVectors(gfx::Vector2dF v1,