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

Unified Diff: cc/resources/picture_layer_tiling.cc

Issue 27223008: Provide approximate type functions for SkMatrix44. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move code to gfx::Transform class. Created 7 years, 2 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 | « no previous file | ui/gfx/transform.h » ('j') | ui/gfx/transform.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4e43190eeac850c817f20108daaa30b6b2f9608e 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,10 @@ 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 (last_screen_transform.IsApproximatelyIdentityOrTranslation(
+ std::numeric_limits<float>::epsilon()) &&
+ current_screen_transform.IsApproximatelyIdentityOrTranslation(
+ std::numeric_limits<float>::epsilon())) {
gfx::Vector2dF current_offset(
current_screen_transform.matrix().get(0, 3),
current_screen_transform.matrix().get(1, 3));
« no previous file with comments | « no previous file | ui/gfx/transform.h » ('j') | ui/gfx/transform.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698