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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 2451273003: cc : Snap texture layers to pixel boundary (Closed)
Patch Set: Created 4 years, 2 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
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 73f82c08f23181e89cc90abb2ba8005d0cf3176c..4a2a1e527cf04fcb15d675bfc0e12387c877e8c5 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -3525,6 +3525,45 @@ TEST_F(LayerTreeHostCommonTest, OcclusionBySiblingOfTarget) {
EXPECT_TRUE(expected_occlusion.IsEqual(actual_occlusion));
}
+TEST_F(LayerTreeHostCommonTest, TextureLayerSnapping) {
+ FakeImplTaskRunnerProvider task_runner_provider;
+ TestSharedBitmapManager shared_bitmap_manager;
+ TestTaskGraphRunner task_graph_runner;
+ std::unique_ptr<CompositorFrameSink> compositor_frame_sink =
+ FakeCompositorFrameSink::Create3d();
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
+ &task_graph_runner);
+
+ std::unique_ptr<LayerImpl> root =
+ LayerImpl::Create(host_impl.active_tree(), 1);
+ std::unique_ptr<TextureLayerImpl> child =
+ TextureLayerImpl::Create(host_impl.active_tree(), 2);
+
+ LayerImpl* child_ptr = child.get();
+
+ root->SetBounds(gfx::Size(100, 100));
+ child->SetBounds(gfx::Size(100, 100));
+ child->SetDrawsContent(true);
+ gfx::Transform fractional_translate;
+ fractional_translate.Translate(10.5f, 10.5f);
enne (OOO) 2016/10/26 20:32:32 Can you use a translation in of these components w
jaydasika 2016/10/26 21:49:13 Done.
+ child->test_properties()->transform = fractional_translate;
+
+ host_impl.SetViewportSize(root->bounds());
+
+ root->test_properties()->AddChild(std::move(child));
+ host_impl.active_tree()->SetRootLayerForTesting(std::move(root));
+ host_impl.SetVisible(true);
+ host_impl.InitializeRenderer(compositor_frame_sink.get());
+ host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting();
+ bool update_lcd_text = false;
+ host_impl.active_tree()->UpdateDrawProperties(update_lcd_text);
+
+ EXPECT_NE(child_ptr->ScreenSpaceTransform(), fractional_translate);
+ fractional_translate.RoundTranslationComponents();
+ EXPECT_TRANSFORMATION_MATRIX_EQ(child_ptr->ScreenSpaceTransform(),
enne (OOO) 2016/10/26 20:32:32 Could you also map this rect into screen space and
jaydasika 2016/10/26 21:49:13 Done.
+ fractional_translate);
+}
+
TEST_F(LayerTreeHostCommonTest,
OcclusionForLayerWithUninvertibleDrawTransform) {
FakeImplTaskRunnerProvider task_runner_provider;

Powered by Google App Engine
This is Rietveld 408576698