Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 2100483003: cc: Change directly composited image raster source scale occasionally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl_unittest.cc
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 758527a13037932aad700dc96c034cbee9390ca3..346e868e6f5b4f78868e7942ea1121f1fe346d02 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -4944,5 +4944,67 @@ TEST_F(PictureLayerImplTest, CompositedImageIgnoreIdealContentsScale) {
EXPECT_EQ(0, data.num_incomplete_tiles);
}
+TEST_F(PictureLayerImplTest, CompositedImageRasterScaleChanges) {
+ gfx::Size layer_bounds(400, 400);
+ scoped_refptr<FakeRasterSource> pending_raster_source =
+ FakeRasterSource::CreateFilled(layer_bounds);
+
+ host_impl()->CreatePendingTree();
+ LayerTreeImpl* pending_tree = host_impl()->pending_tree();
+
+ std::unique_ptr<FakePictureLayerImpl> pending_layer =
+ FakePictureLayerImpl::CreateWithRasterSource(pending_tree, layer_id(),
+ pending_raster_source);
+ pending_layer->set_is_directly_composited_image(true);
+ pending_layer->SetDrawsContent(true);
+ FakePictureLayerImpl* pending_layer_ptr = pending_layer.get();
+ pending_tree->SetRootLayer(std::move(pending_layer));
+ pending_tree->BuildLayerListAndPropertyTreesForTesting();
+
+ float expected_contents_scale = 0.25f;
+ for (int i = 1; i < 30; ++i) {
+ float ideal_contents_scale = 0.1f * i - 1e-6;
+ switch (i) {
+ // Scale 0.3.
+ case 3:
+ expected_contents_scale = 0.5f;
+ break;
+ // Scale 0.6.
+ case 6:
+ expected_contents_scale = 1.f;
+ break;
+ }
+ SetupDrawPropertiesAndUpdateTiles(pending_layer_ptr, ideal_contents_scale,
+ 1.f, 1.f, 1.f, 1.f, false);
+ EXPECT_FLOAT_EQ(expected_contents_scale,
+ pending_layer_ptr->picture_layer_tiling_set()
+ ->FindTilingWithResolution(HIGH_RESOLUTION)
+ ->contents_scale())
+ << "ideal_contents_scale: " << ideal_contents_scale;
+ }
+
+ expected_contents_scale = 1.f;
+ for (int i = 30; i >= 1; --i) {
+ float ideal_contents_scale = 0.1f * i - 1e-6;
+ switch (i) {
+ // Scale 0.2.
+ case 2:
+ expected_contents_scale = 0.5f;
+ break;
+ // Scale 0.1.
+ case 1:
+ expected_contents_scale = 0.25f;
+ break;
+ }
+ SetupDrawPropertiesAndUpdateTiles(pending_layer_ptr, ideal_contents_scale,
+ 1.f, 1.f, 1.f, 1.f, false);
+ EXPECT_FLOAT_EQ(expected_contents_scale,
+ pending_layer_ptr->picture_layer_tiling_set()
+ ->FindTilingWithResolution(HIGH_RESOLUTION)
+ ->contents_scale())
+ << "ideal_contents_scale: " << ideal_contents_scale;
+ }
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698