diff options
author | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-01 05:10:36 +0000 |
---|---|---|
committer | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-01 05:10:36 +0000 |
commit | e43c68b34435712301041a18b120af22b7e57418 (patch) | |
tree | 37428b27cb094f2b7ce23651eb3cb2fc24ff9986 /cc | |
parent | 74d9c5245d657e577a9060db156444952f9b96c7 (diff) | |
download | chromium_src-e43c68b34435712301041a18b120af22b7e57418.zip chromium_src-e43c68b34435712301041a18b120af22b7e57418.tar.gz chromium_src-e43c68b34435712301041a18b120af22b7e57418.tar.bz2 |
Don't early out in PreCalculateMetaInformation
Currently, we bail early in this function if we encounter a layer with
a singular transform. This causes problems because we depend on a full
tree walk in order to clear DrawProperties::sorted_for_recursion. This
cl prevents this early out.
(Note: this does not affect other optimizations to prevent the drawing
of subtrees rooted at layers with singular transforms.)
R=ajuma@chromium.org,danakj@chromium.org
BUG=366233
Review URL: https://codereview.chromium.org/263643007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267438 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/trees/layer_tree_host_common.cc | 9 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_common_unittest.cc | 47 |
2 files changed, 54 insertions, 2 deletions
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc index 49f11dc..655b405 100644 --- a/cc/trees/layer_tree_host_common.cc +++ b/cc/trees/layer_tree_host_common.cc @@ -476,13 +476,18 @@ static bool LayerShouldBeSkipped(LayerType* layer, bool layer_is_drawn) { return false; } +template <typename LayerType> +static bool HasInvertibleOrAnimatedTransform(LayerType* layer) { + return layer->transform_is_invertible() || layer->TransformIsAnimating(); +} + static inline bool SubtreeShouldBeSkipped(LayerImpl* layer, bool layer_is_drawn) { // If the layer transform is not invertible, it should not be drawn. // TODO(ajuma): Correctly process subtrees with singular transform for the // case where we may animate to a non-singular transform and wish to // pre-raster. - if (!layer->transform_is_invertible() && !layer->TransformIsAnimating()) + if (!HasInvertibleOrAnimatedTransform(layer)) return true; // When we need to do a readback/copy of a layer's output, we can not skip @@ -1169,7 +1174,7 @@ static void PreCalculateMetaInformation( bool has_delegated_content = layer->HasDelegatedContent(); int num_descendants_that_draw_content = 0; - if (!layer->transform_is_invertible()) { + if (!HasInvertibleOrAnimatedTransform(layer)) { // Layers with singular transforms should not be drawn, the whole subtree // can be skipped. return; diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index b5e23f3..ad4f60b 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc @@ -2978,6 +2978,53 @@ TEST_F(LayerTreeHostCommonTest, } TEST_F(LayerTreeHostCommonTest, + SingularTransformDoesNotPreventClearingDrawProperties) { + scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<LayerWithForcedDrawsContent> child = + make_scoped_refptr(new LayerWithForcedDrawsContent()); + root->AddChild(child); + + scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); + host->SetRootLayer(root); + + gfx::Transform identity_matrix; + gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); + ASSERT_FALSE(uninvertible_matrix.IsInvertible()); + + SetLayerPropertiesForTesting(root.get(), + uninvertible_matrix, + gfx::PointF(), + gfx::PointF(), + gfx::Size(100, 100), + true, + false); + SetLayerPropertiesForTesting(child.get(), + identity_matrix, + gfx::PointF(), + gfx::PointF(5.f, 5.f), + gfx::Size(50, 50), + true, + false); + + child->draw_properties().sorted_for_recursion = true; + + TransformOperations start_transform_operations; + start_transform_operations.AppendScale(1.f, 0.f, 0.f); + + TransformOperations end_transform_operations; + end_transform_operations.AppendScale(1.f, 1.f, 0.f); + + AddAnimatedTransformToLayer( + root.get(), 10.0, start_transform_operations, end_transform_operations); + + EXPECT_TRUE(root->TransformIsAnimating()); + + ExecuteCalculateDrawProperties(root.get()); + + EXPECT_FALSE(child->draw_properties().sorted_for_recursion); +} + +TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForLayersInClippedRenderSurface) { scoped_refptr<Layer> root = Layer::Create(); scoped_refptr<Layer> render_surface1 = Layer::Create(); |