summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-02 05:09:28 +0000
committerreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-02 05:09:28 +0000
commit13296ed1ed86b4ce7885468f38fc03b775edc575 (patch)
treec19fb8d535081424a084b1895b339f5726afb2a9 /cc
parent92dd57078241e79a22755109f16d3847a682b4c1 (diff)
downloadchromium_src-13296ed1ed86b4ce7885468f38fc03b775edc575.zip
chromium_src-13296ed1ed86b4ce7885468f38fc03b775edc575.tar.gz
chromium_src-13296ed1ed86b4ce7885468f38fc03b775edc575.tar.bz2
cc: Make sure tilings are re-created after losing context
Reset raster scale in PictureLayerImpl::DidLoseOutputSurface() so that necessary tilings are re-created next time PictureLayerImpl::ManageTilings() is called. BUG=222943 TEST=cc_unittests --gtest_filter=PictureLayerImplTest.DidLoseOutputSurface Review URL: https://chromiumcodereview.appspot.com/13414004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191780 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/layers/picture_layer_impl.cc4
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc35
2 files changed, 39 insertions, 0 deletions
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index c361804..6e929b3 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -295,6 +295,10 @@ void PictureLayerImpl::DidBecomeActive() {
void PictureLayerImpl::DidLoseOutputSurface() {
if (tilings_)
tilings_->RemoveAllTilings();
+
+ raster_page_scale_ = 0;
+ raster_device_scale_ = 0;
+ raster_source_scale_ = 0;
}
void PictureLayerImpl::CalculateContentsScale(
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index b3ce6bd..4f00ed7 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -692,5 +692,40 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
ASSERT_EQ(2u, active_layer_->tilings().num_tilings());
}
+TEST_F(PictureLayerImplTest, DidLoseOutputSurface) {
+ gfx::Size tile_size(400, 400);
+ gfx::Size layer_bounds(1300, 1900);
+
+ scoped_refptr<TestablePicturePileImpl> pending_pile =
+ TestablePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
+ scoped_refptr<TestablePicturePileImpl> active_pile =
+ TestablePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
+
+ float result_scale_x, result_scale_y;
+ gfx::Size result_bounds;
+
+ SetupTrees(pending_pile, active_pile);
+ EXPECT_EQ(0u, pending_layer_->tilings().num_tilings());
+
+ // These are included in the scale given to the layer.
+ host_impl_.SetDeviceScaleFactor(1.7f);
+ host_impl_.pending_tree()->SetPageScaleFactorAndLimits(3.2f, 3.2f, 3.2f);
+
+ pending_layer_->CalculateContentsScale(
+ 1.3f, false, &result_scale_x, &result_scale_y, &result_bounds);
+ EXPECT_EQ(2u, pending_layer_->tilings().num_tilings());
+
+ // All tilings should be removed when losing output surface.
+ active_layer_->DidLoseOutputSurface();
+ EXPECT_EQ(0u, active_layer_->tilings().num_tilings());
+ pending_layer_->DidLoseOutputSurface();
+ EXPECT_EQ(0u, pending_layer_->tilings().num_tilings());
+
+ // This should create new tilings.
+ pending_layer_->CalculateContentsScale(
+ 1.3f, false, &result_scale_x, &result_scale_y, &result_bounds);
+ EXPECT_EQ(2u, pending_layer_->tilings().num_tilings());
+}
+
} // namespace
} // namespace cc