summaryrefslogtreecommitdiffstats
path: root/cc/layers/picture_layer_impl.cc
diff options
context:
space:
mode:
authorenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-22 07:50:00 +0000
committerenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-22 07:50:00 +0000
commit9d03b1a3dc2ada552c39c68a9c8faf07287f9a86 (patch)
tree642964c477c3be098df77fcc39202bc6876f0ba3 /cc/layers/picture_layer_impl.cc
parent852185659ee97b95d751e6523d994f168aa84c3b (diff)
downloadchromium_src-9d03b1a3dc2ada552c39c68a9c8faf07287f9a86.zip
chromium_src-9d03b1a3dc2ada552c39c68a9c8faf07287f9a86.tar.gz
chromium_src-9d03b1a3dc2ada552c39c68a9c8faf07287f9a86.tar.bz2
cc: Allow layers to have tilings even if twin doesn't
This fixes a bug where an active layer has a valid raster scale but can't have tilings. When a pending layer that could have tilings syncs to it, it picks up these raster scales and so doesn't think it needs to change tilings, even though it doesn't have any. Worse, this state would continue to persist for every future pending layer that can have tilings because they would also pick up these raster scales without tilings and think they were in an acceptable state. This patch addresses this problem by always making sure that raster scales are reset whenever a layer can't have tilings. This causes PictureLayerImpl::ManageTilings to not early out and to create new tilings as soon as it is possible. R=danakj@chromium.org BUG=313598 Review URL: https://codereview.chromium.org/78853006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236716 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers/picture_layer_impl.cc')
-rw-r--r--cc/layers/picture_layer_impl.cc23
1 files changed, 19 insertions, 4 deletions
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 9aaad29..29f5110 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -383,7 +383,7 @@ void PictureLayerImpl::DidBeginTracing() {
void PictureLayerImpl::DidLoseOutputSurface() {
if (tilings_)
- tilings_->RemoveAllTilings();
+ RemoveAllTilings();
ResetRasterScale();
}
@@ -553,8 +553,7 @@ void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
UpdateLCDTextStatus(other->is_using_lcd_text_);
if (!DrawsContent()) {
- ResetRasterScale();
- tilings_->RemoveAllTilings();
+ RemoveAllTilings();
return;
}
@@ -597,7 +596,7 @@ void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
tiling_invalidation,
MinimumContentsScale());
} else {
- tilings_->RemoveAllTilings();
+ RemoveAllTilings();
}
SanityCheckTilingState();
@@ -778,9 +777,17 @@ void PictureLayerImpl::RemoveTiling(float contents_scale) {
break;
}
}
+ if (tilings_->num_tilings() == 0)
+ ResetRasterScale();
SanityCheckTilingState();
}
+void PictureLayerImpl::RemoveAllTilings() {
+ tilings_->RemoveAllTilings();
+ // If there are no tilings, then raster scales are no longer meaningful.
+ ResetRasterScale();
+}
+
namespace {
inline float PositiveRatio(float float1, float float2) {
@@ -807,6 +814,11 @@ void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) {
low_res_raster_contents_scale_ == 0.f ||
ShouldAdjustRasterScale(animating_transform_to_screen);
+ if (tilings_->num_tilings() == 0) {
+ DCHECK(change_target_tiling)
+ << "A layer with no tilings shouldn't have valid raster scales";
+ }
+
// Store the value for the next time ShouldAdjustRasterScale is called.
raster_source_scale_was_animating_ = animating_transform_to_screen;
@@ -931,6 +943,8 @@ void PictureLayerImpl::CalculateRasterContentsScale(
void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
std::vector<PictureLayerTiling*> used_tilings) {
DCHECK(layer_tree_impl()->IsActiveTree());
+ if (tilings_->num_tilings() == 0)
+ return;
float min_acceptable_high_res_scale = std::min(
raster_contents_scale_, ideal_contents_scale_);
@@ -974,6 +988,7 @@ void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
twin->RemoveTiling(to_remove[i]->contents_scale());
tilings_->Remove(to_remove[i]);
}
+ DCHECK_GT(tilings_->num_tilings(), 0u);
SanityCheckTilingState();
}