Commit 1a159657 authored by danakj@chromium.org's avatar danakj@chromium.org

cc: Early out sooner in UpdateTilePriorities when !CanHaveTilings().

Also, when we cleanup tilings on the active twin, we use the pending
twin's ideal contents scale. But when the twin !CanHavTilings() there
is no need to use that ideal scale and save tilings.

R=enne@chromium.org, enne

Review URL: https://codereview.chromium.org/334953003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278219 0039d316-1c4b-4281-b951-d872f2087c98
parent f113be51
...@@ -390,14 +390,6 @@ void PictureLayerImpl::UpdateTilePriorities() { ...@@ -390,14 +390,6 @@ void PictureLayerImpl::UpdateTilePriorities() {
TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities");
DoPostCommitInitializationIfNeeded(); 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()) { if (layer_tree_impl()->device_viewport_valid_for_tile_management()) {
visible_rect_for_tile_priority_ = visible_content_rect(); visible_rect_for_tile_priority_ = visible_content_rect();
...@@ -405,6 +397,23 @@ void PictureLayerImpl::UpdateTilePriorities() { ...@@ -405,6 +397,23 @@ void PictureLayerImpl::UpdateTilePriorities() {
screen_space_transform_for_tile_priority_ = screen_space_transform(); 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()) if (!tilings_->num_tilings())
return; return;
...@@ -1149,7 +1158,7 @@ void PictureLayerImpl::CleanUpTilingsOnActiveLayer( ...@@ -1149,7 +1158,7 @@ void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
float twin_low_res_scale = 0.f; float twin_low_res_scale = 0.f;
PictureLayerImpl* twin = twin_layer_; PictureLayerImpl* twin = twin_layer_;
if (twin) { if (twin && twin->CanHaveTilings()) {
min_acceptable_high_res_scale = std::min( min_acceptable_high_res_scale = std::min(
min_acceptable_high_res_scale, min_acceptable_high_res_scale,
std::min(twin->raster_contents_scale_, twin->ideal_contents_scale_)); std::min(twin->raster_contents_scale_, twin->ideal_contents_scale_));
...@@ -1272,14 +1281,7 @@ float PictureLayerImpl::MaximumTilingContentsScale() const { ...@@ -1272,14 +1281,7 @@ float PictureLayerImpl::MaximumTilingContentsScale() const {
} }
void PictureLayerImpl::UpdateIdealScales() { void PictureLayerImpl::UpdateIdealScales() {
if (!CanHaveTilings()) { DCHECK(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;
}
float min_contents_scale = MinimumContentsScale(); float min_contents_scale = MinimumContentsScale();
DCHECK_GT(min_contents_scale, 0.f); DCHECK_GT(min_contents_scale, 0.f);
......
...@@ -2774,5 +2774,50 @@ TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) { ...@@ -2774,5 +2774,50 @@ TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) {
quad_culler.shared_quad_state_list()[0]->visible_content_rect.ToString()); 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
} // namespace cc } // namespace cc
...@@ -6574,61 +6574,5 @@ TEST_F(LayerTreeHostImplWithImplicitLimitsTest, ImplicitMemoryLimits) { ...@@ -6574,61 +6574,5 @@ TEST_F(LayerTreeHostImplWithImplicitLimitsTest, ImplicitMemoryLimits) {
150u * 1024u * 1024u); 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
} // namespace cc } // namespace cc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment