diff options
author | vollick <vollick@chromium.org> | 2015-04-24 10:30:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-24 17:30:46 +0000 |
commit | 9a706e68a90749d54e336829ae759a56931ccf31 (patch) | |
tree | b088959581126498855d5aee042daa5bdb3e1dd5 /cc | |
parent | 79289369bee811b37d810710fbcfe44a822d525c (diff) | |
download | chromium_src-9a706e68a90749d54e336829ae759a56931ccf31.zip chromium_src-9a706e68a90749d54e336829ae759a56931ccf31.tar.gz chromium_src-9a706e68a90749d54e336829ae759a56931ccf31.tar.bz2 |
Fix ApproximatelyEqual for transforms
I subtly broke this in https://codereview.chromium.org/1071803003. Due
to a cut and paste error, we were never updating |delta|.
Consequently, I missed a regression due to my property trees skipping:
I wasn't forcing a rebuild when contents scale or content bounds
changed (and this was required). I've fixed that in this CL as well.
BUG=471786
Review URL: https://codereview.chromium.org/1105933002
Cr-Commit-Position: refs/heads/master@{#326827}
Diffstat (limited to 'cc')
-rw-r--r-- | cc/layers/contents_scaling_layer.cc | 13 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_common.cc | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/cc/layers/contents_scaling_layer.cc b/cc/layers/contents_scaling_layer.cc index 733bac0..b44830f 100644 --- a/cc/layers/contents_scaling_layer.cc +++ b/cc/layers/contents_scaling_layer.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "cc/layers/contents_scaling_layer.h" +#include "cc/trees/layer_tree_host.h" #include "ui/gfx/geometry/size_conversions.h" namespace cc { @@ -25,11 +26,23 @@ void ContentsScalingLayer::CalculateContentsScale( float* contents_scale_x, float* contents_scale_y, gfx::Size* content_bounds) { + float old_contents_scale_x = *contents_scale_x; + float old_contents_scale_y = *contents_scale_y; + gfx::Size old_content_bounds = *content_bounds; *contents_scale_x = ideal_contents_scale; *contents_scale_y = ideal_contents_scale; *content_bounds = ComputeContentBoundsForScale( ideal_contents_scale, ideal_contents_scale); + + if (!layer_tree_host()) + return; + + if (old_contents_scale_x != *contents_scale_x || + old_contents_scale_y != *contents_scale_y || + old_content_bounds != *content_bounds) { + layer_tree_host()->property_trees()->needs_rebuild = true; + } } bool ContentsScalingLayer::Update(ResourceUpdateQueue* queue, diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc index 31f64d6..6b2c5b6 100644 --- a/cc/trees/layer_tree_host_common.cc +++ b/cc/trees/layer_tree_host_common.cc @@ -2480,7 +2480,7 @@ static bool ApproximatelyEqual(const gfx::Transform& a, for (int row = 0; row < 4; row++) { for (int col = 0; col < 4; col++) { - static const float delta = + const float delta = std::abs(a.matrix().get(row, col) - b.matrix().get(row, col)); const float tolerance = col == 3 && row < 3 ? translation_tolerance : component_tolerance; |