summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/layers/picture_image_layer_impl_unittest.cc2
-rw-r--r--cc/layers/picture_layer_impl.cc36
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc45
-rw-r--r--cc/test/fake_picture_layer_impl.h2
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc56
5 files changed, 66 insertions, 75 deletions
diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc
index 005a323..e6f1f34 100644
--- a/cc/layers/picture_image_layer_impl_unittest.cc
+++ b/cc/layers/picture_image_layer_impl_unittest.cc
@@ -32,8 +32,8 @@ class TestablePictureImageLayerImpl : public PictureImageLayerImpl {
void ScaleAndManageTilings(bool animating_transform_to_screen,
float maximum_animation_contents_scale) {
DoPostCommitInitializationIfNeeded();
- UpdateIdealScales();
if (CanHaveTilings()) {
+ UpdateIdealScales();
ManageTilings(animating_transform_to_screen,
maximum_animation_contents_scale);
}
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index d75ad8c..7299bc0 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -391,14 +391,6 @@ void PictureLayerImpl::UpdateTilePriorities() {
TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities");
DoPostCommitInitializationIfNeeded();
- UpdateIdealScales();
- // TODO(sohanjg): Avoid needlessly update priorities when syncing to a
- // non-updated tree which will then be updated immediately afterwards.
- should_update_tile_priorities_ = true;
- if (CanHaveTilings()) {
- ManageTilings(draw_properties().screen_space_transform_is_animating,
- draw_properties().maximum_animation_contents_scale);
- }
if (layer_tree_impl()->device_viewport_valid_for_tile_management()) {
visible_rect_for_tile_priority_ = visible_content_rect();
@@ -406,6 +398,23 @@ void PictureLayerImpl::UpdateTilePriorities() {
screen_space_transform_for_tile_priority_ = screen_space_transform();
}
+ if (!CanHaveTilings()) {
+ ideal_page_scale_ = 0.f;
+ ideal_device_scale_ = 0.f;
+ ideal_contents_scale_ = 0.f;
+ ideal_source_scale_ = 0.f;
+ SanityCheckTilingState();
+ return;
+ }
+
+ // TODO(sohanjg): Avoid needlessly update priorities when syncing to a
+ // non-updated tree which will then be updated immediately afterwards.
+ should_update_tile_priorities_ = true;
+
+ UpdateIdealScales();
+ ManageTilings(draw_properties().screen_space_transform_is_animating,
+ draw_properties().maximum_animation_contents_scale);
+
if (!tilings_->num_tilings())
return;
@@ -1150,7 +1159,7 @@ void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
float twin_low_res_scale = 0.f;
PictureLayerImpl* twin = twin_layer_;
- if (twin) {
+ if (twin && twin->CanHaveTilings()) {
min_acceptable_high_res_scale = std::min(
min_acceptable_high_res_scale,
std::min(twin->raster_contents_scale_, twin->ideal_contents_scale_));
@@ -1273,14 +1282,7 @@ float PictureLayerImpl::MaximumTilingContentsScale() const {
}
void PictureLayerImpl::UpdateIdealScales() {
- if (!CanHaveTilings()) {
- ideal_page_scale_ = draw_properties().page_scale_factor;
- ideal_device_scale_ = draw_properties().device_scale_factor;
- ideal_contents_scale_ = draw_properties().ideal_contents_scale;
- ideal_source_scale_ =
- ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_;
- return;
- }
+ DCHECK(CanHaveTilings());
float min_contents_scale = MinimumContentsScale();
DCHECK_GT(min_contents_scale, 0.f);
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index c26f74b..38e20e2 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -2774,5 +2774,50 @@ TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) {
quad_culler.shared_quad_state_list()[0]->visible_content_rect.ToString());
}
+TEST_F(PictureLayerImplTest, UpdateTilesForMasksWithNoVisibleContent) {
+ gfx::Size tile_size(400, 400);
+ gfx::Size bounds(100000, 100);
+
+ host_impl_.CreatePendingTree();
+
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_.pending_tree(), 1);
+
+ scoped_ptr<FakePictureLayerImpl> layer_with_mask =
+ FakePictureLayerImpl::Create(host_impl_.pending_tree(), 2);
+
+ layer_with_mask->SetBounds(bounds);
+ layer_with_mask->SetContentBounds(bounds);
+
+ scoped_refptr<FakePicturePileImpl> pending_pile =
+ FakePicturePileImpl::CreateFilledPile(tile_size, bounds);
+ scoped_ptr<FakePictureLayerImpl> mask = FakePictureLayerImpl::CreateWithPile(
+ host_impl_.pending_tree(), 3, pending_pile);
+
+ mask->SetIsMask(true);
+ mask->SetBounds(bounds);
+ mask->SetContentBounds(bounds);
+ mask->SetDrawsContent(true);
+
+ FakePictureLayerImpl* pending_mask_content = mask.get();
+ layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>());
+
+ scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask =
+ FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4);
+
+ child_of_layer_with_mask->SetBounds(bounds);
+ child_of_layer_with_mask->SetContentBounds(bounds);
+ child_of_layer_with_mask->SetDrawsContent(true);
+
+ layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>());
+
+ root->AddChild(layer_with_mask.PassAs<LayerImpl>());
+
+ host_impl_.pending_tree()->SetRootLayer(root.Pass());
+
+ EXPECT_FALSE(pending_mask_content->tilings());
+ host_impl_.pending_tree()->UpdateDrawProperties();
+ EXPECT_NE(0u, pending_mask_content->num_tilings());
+}
+
} // namespace
} // namespace cc
diff --git a/cc/test/fake_picture_layer_impl.h b/cc/test/fake_picture_layer_impl.h
index 38caff8..0b289b2 100644
--- a/cc/test/fake_picture_layer_impl.h
+++ b/cc/test/fake_picture_layer_impl.h
@@ -96,8 +96,8 @@ class FakePictureLayerImpl : public PictureLayerImpl {
void ScaleAndManageTilings(bool animating_transform_to_screen,
float maximum_animation_contents_scale) {
- UpdateIdealScales();
if (CanHaveTilings()) {
+ UpdateIdealScales();
ManageTilings(animating_transform_to_screen,
maximum_animation_contents_scale);
}
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 6c74777..f415c51 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -6573,61 +6573,5 @@ TEST_F(LayerTreeHostImplWithImplicitLimitsTest, ImplicitMemoryLimits) {
150u * 1024u * 1024u);
}
-TEST_F(LayerTreeHostImplTest, UpdateTilesForMasksWithNoVisibleContent) {
- gfx::Size bounds(100000, 100);
-
- host_impl_->CreatePendingTree();
-
- scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->pending_tree(), 1);
-
- scoped_ptr<FakePictureLayerImpl> layer_with_mask =
- FakePictureLayerImpl::Create(host_impl_->pending_tree(), 2);
-
- layer_with_mask->SetBounds(bounds);
- layer_with_mask->SetContentBounds(bounds);
-
- scoped_ptr<FakePictureLayerImpl> mask =
- FakePictureLayerImpl::Create(host_impl_->pending_tree(), 3);
-
- mask->SetIsMask(true);
- mask->SetBounds(bounds);
- mask->SetContentBounds(bounds);
-
- FakePictureLayerImpl* pending_mask_content = mask.get();
- layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>());
-
- scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask =
- FakePictureLayerImpl::Create(host_impl_->pending_tree(), 4);
-
- child_of_layer_with_mask->SetBounds(bounds);
- child_of_layer_with_mask->SetContentBounds(bounds);
- child_of_layer_with_mask->SetDrawsContent(true);
-
- layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>());
-
- root->AddChild(layer_with_mask.PassAs<LayerImpl>());
-
- host_impl_->pending_tree()->SetRootLayer(root.Pass());
-
- gfx::Rect r1 = pending_mask_content->visible_rect_for_tile_priority();
- ASSERT_EQ(0, r1.x());
- ASSERT_EQ(0, r1.y());
- ASSERT_EQ(0, r1.width());
- ASSERT_EQ(0, r1.height());
-
- host_impl_->ActivatePendingTree();
-
- host_impl_->active_tree()->UpdateDrawProperties();
-
- ASSERT_EQ(2u, host_impl_->active_tree()->RenderSurfaceLayerList().size());
-
- FakePictureLayerImpl* active_mask_content =
- static_cast<FakePictureLayerImpl*>(
- host_impl_->active_tree()->root_layer()->children()[0]->mask_layer());
- gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority();
-
- ASSERT_TRUE(!r2.IsEmpty());
-}
-
} // namespace
} // namespace cc