Index: cc/resources/picture_layer_tiling.cc |
diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc |
index fc17e50f51192c49e832a322d50f736321877d98..d968cd806d931376a536094d2671f50262a819f3 100644 |
--- a/cc/resources/picture_layer_tiling.cc |
+++ b/cc/resources/picture_layer_tiling.cc |
@@ -339,35 +339,6 @@ void PictureLayerTiling::Reset() { |
tiles_.clear(); |
} |
-namespace { |
- |
-bool NearlyOne(SkMScalar lhs) { |
- return std::abs(lhs-1.0) < std::numeric_limits<float>::epsilon(); |
-} |
- |
-bool NearlyZero(SkMScalar lhs) { |
- return std::abs(lhs) < std::numeric_limits<float>::epsilon(); |
-} |
- |
-bool ApproximatelyTranslation(const SkMatrix44& matrix) { |
- return |
- NearlyOne(matrix.get(0, 0)) && |
- NearlyZero(matrix.get(1, 0)) && |
- NearlyZero(matrix.get(2, 0)) && |
- matrix.get(3, 0) == 0 && |
- NearlyZero(matrix.get(0, 1)) && |
- NearlyOne(matrix.get(1, 1)) && |
- NearlyZero(matrix.get(2, 1)) && |
- matrix.get(3, 1) == 0 && |
- NearlyZero(matrix.get(0, 2)) && |
- NearlyZero(matrix.get(1, 2)) && |
- NearlyOne(matrix.get(2, 2)) && |
- matrix.get(3, 2) == 0 && |
- matrix.get(3, 3) == 1; |
-} |
- |
-} // namespace |
- |
void PictureLayerTiling::UpdateTilePriorities( |
WhichTree tree, |
gfx::Size device_viewport, |
@@ -424,8 +395,12 @@ void PictureLayerTiling::UpdateTilePriorities( |
float last_scale = last_layer_contents_scale / contents_scale_; |
// Fast path tile priority calculation when both transforms are translations. |
- if (ApproximatelyTranslation(last_screen_transform.matrix()) && |
- ApproximatelyTranslation(current_screen_transform.matrix())) { |
+ if (MathUtil::IsMatrixApproximatelyPureTranslation( |
+ last_screen_transform.matrix(), |
+ std::numeric_limits<float>::epsilon()) && |
+ MathUtil::IsMatrixApproximatelyPureTranslation( |
+ current_screen_transform.matrix(), |
+ std::numeric_limits<float>::epsilon())) { |
gfx::Vector2dF current_offset( |
current_screen_transform.matrix().get(0, 3), |
current_screen_transform.matrix().get(1, 3)); |