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

Unified Diff: cc/layers/tiled_layer_unittest.cc

Issue 85143002: Dirty rects always contain full tiles with delegated rendering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed broken test due to this patch Created 7 years 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/layers/tiled_layer_unittest.cc
diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc
index 42ef29cc93ed27959bb30d510a279d9cb90fe9b9..0a50968ef99ec5609d3a6ea9de90317dfef41170 100644
--- a/cc/layers/tiled_layer_unittest.cc
+++ b/cc/layers/tiled_layer_unittest.cc
@@ -1134,6 +1134,48 @@ TEST_F(TiledLayerPartialUpdateTest, PartialUpdates) {
layer_tree_host_->SetRootLayer(NULL);
}
+TEST_F(TiledLayerPartialUpdateTest, \
danakj 2013/12/02 15:06:52 no \ needed
+ VerifyUpdateRectIsPreparedFromOriginalDirtyRects) {
+ // Create one 300 x 200 tiled layer with 3 x 2 tiles.
+ gfx::Rect layer_bounds(0, 0, 300, 200);
+ gfx::Rect dirty_rect(75, 75, 50, 50);
+ gfx::Rect expected_paint_rect(0, 0, 200, 200);
+
+ scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(
+ new FakeTiledLayer(layer_tree_host_->contents_texture_manager()));
+
+ layer->SetBounds(layer_bounds.size());
+ layer->SetPosition(gfx::PointF(0, 0));
+ layer->draw_properties().visible_content_rect = layer_bounds;
+ layer_tree_host_->SetRootLayer(layer);
+ layer_tree_host_->SetViewportSize(gfx::Size(300, 200));
+
+ // Simulate delegating renderer scenario by not allowing partial texture
+ // updates by default.
+ const_cast<RendererCapabilities&>(layer_tree_host_->proxy()->
+ GetRendererCapabilities()).allow_partial_texture_updates = false;
+
+ // Update all tiles in first update.
+ layer->InvalidateContentRect(layer_bounds);
+ layer_tree_host_->UpdateLayers(queue_.get());
+ UpdateTextures();
+
+ // Now update_rect should contain only dirty_rect.
+ layer->InvalidateContentRect(dirty_rect);
+ layer_tree_host_->UpdateLayers(queue_.get());
+ UpdateTextures();
+
+ gfx::Rect paint_rect = layer->fake_layer_updater()->last_update_rect();
+ EXPECT_FLOAT_RECT_EQ(static_cast<gfx::RectF>(dirty_rect),
+ layer->update_rect());
+ EXPECT_RECT_EQ(expected_paint_rect, paint_rect);
+ EXPECT_FALSE(dirty_rect.Contains(paint_rect));
+
+ ResourceManagerClearAllMemory(layer_tree_host_->contents_texture_manager(),
+ resource_provider_.get());
+ layer_tree_host_->SetRootLayer(NULL);
+}
+
TEST_F(TiledLayerTest, TilesPaintedWithoutOcclusion) {
scoped_refptr<FakeTiledLayer> layer =
make_scoped_refptr(new FakeTiledLayer(resource_manager_.get()));

Powered by Google App Engine
This is Rietveld 408576698