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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 19734014: cc: Add some unit tests for readbacks outside of the viewport. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | « no previous file | cc/trees/layer_tree_host_pixeltest_readback.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f00120553226a927ec36abfbfe0bbf105b688bdc..0a8f5f6f9268168c19b7028302a3e8bdc6f1e6cc 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -8522,5 +8522,64 @@ TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id());
}
+TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) {
+ FakeImplProxy proxy;
+ FakeLayerTreeHostImpl host_impl(&proxy);
+ host_impl.CreatePendingTree();
+ const gfx::Transform identity_matrix;
+
+ scoped_refptr<Layer> root = Layer::Create();
+ SetLayerPropertiesForTesting(root.get(),
+ identity_matrix,
+ identity_matrix,
+ gfx::PointF(),
+ gfx::PointF(),
+ gfx::Size(50, 50),
+ false);
+ root->SetIsDrawable(true);
+
+ // The surface is moved slightly outside of the viewport.
+ scoped_refptr<Layer> surface = Layer::Create();
+ SetLayerPropertiesForTesting(surface.get(),
+ identity_matrix,
+ identity_matrix,
+ gfx::PointF(),
+ gfx::PointF(-10, -20),
+ gfx::Size(),
+ false);
+ surface->SetForceRenderSurface(true);
+
+ scoped_refptr<Layer> surface_child = Layer::Create();
+ SetLayerPropertiesForTesting(surface_child.get(),
+ identity_matrix,
+ identity_matrix,
+ gfx::PointF(),
+ gfx::PointF(),
+ gfx::Size(50, 50),
+ false);
+ surface_child->SetIsDrawable(true);
+
+ surface->AddChild(surface_child);
+ root->AddChild(surface);
+
+ RenderSurfaceLayerList render_surface_layer_list;
+ int dummy_max_texture_size = 512;
+ LayerTreeHostCommon::CalculateDrawProperties(root.get(),
+ root->bounds(),
+ gfx::Transform(),
+ 1.f,
+ 1.f,
+ NULL,
+ dummy_max_texture_size,
+ false,
+ true, // can_adjust_raster_scale
+ &render_surface_layer_list);
+
+ // The visible_content_rect for the |surface_child| should not be clipped by
+ // the viewport.
+ EXPECT_EQ(gfx::Rect(50, 50).ToString(),
+ surface_child->visible_content_rect().ToString());
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_pixeltest_readback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698