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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 681713002: Update from chromium https://crrev.com/301315 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/layers/solid_color_layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 AppendQuadsData data; 1424 AppendQuadsData data;
1425 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr); 1425 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr);
1426 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); 1426 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data);
1427 active_layer_->DidDraw(nullptr); 1427 active_layer_->DidDraw(nullptr);
1428 1428
1429 ASSERT_EQ(1U, render_pass->quad_list.size()); 1429 ASSERT_EQ(1U, render_pass->quad_list.size());
1430 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, 1430 EXPECT_EQ(DrawQuad::PICTURE_CONTENT,
1431 render_pass->quad_list.front()->material); 1431 render_pass->quad_list.front()->material);
1432 } 1432 }
1433 1433
1434 TEST_F(PictureLayerImplTest, SolidColorLayerHasVisibleFullCoverage) {
1435 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
1436
1437 gfx::Size tile_size(1000, 1000);
1438 gfx::Size layer_bounds(1500, 1500);
1439 gfx::Rect visible_rect(1000, 1000);
1440
1441 scoped_refptr<FakePicturePileImpl> pending_pile =
1442 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds);
1443 scoped_refptr<FakePicturePileImpl> active_pile =
1444 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds);
1445
1446 pending_pile->set_is_solid_color(true);
1447 active_pile->set_is_solid_color(true);
1448
1449 SetupTrees(pending_pile, active_pile);
1450
1451 active_layer_->draw_properties().visible_content_rect = visible_rect;
1452
1453 AppendQuadsData data;
1454 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr);
1455 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data);
1456 active_layer_->DidDraw(nullptr);
1457
1458 Region remaining = visible_rect;
1459 for (auto& quad : render_pass->quad_list) {
1460 EXPECT_TRUE(visible_rect.Contains(quad.rect));
1461 EXPECT_TRUE(remaining.Contains(quad.rect));
1462 remaining.Subtract(quad.rect);
1463 }
1464
1465 EXPECT_TRUE(remaining.IsEmpty());
1466 }
1467
1434 TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) { 1468 TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) {
1435 gfx::Size tile_size(100, 100); 1469 gfx::Size tile_size(100, 100);
1436 gfx::Size layer_bounds(200, 200); 1470 gfx::Size layer_bounds(200, 200);
1437 1471
1438 scoped_refptr<FakePicturePileImpl> pending_pile = 1472 scoped_refptr<FakePicturePileImpl> pending_pile =
1439 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1473 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1440 SetupPendingTree(pending_pile); 1474 SetupPendingTree(pending_pile);
1441 1475
1442 gfx::Transform transform; 1476 gfx::Transform transform;
1443 gfx::Transform transform_for_tile_priority; 1477 gfx::Transform transform_for_tile_priority;
(...skipping 2938 matching lines...) Expand 10 before | Expand all | Expand 10 after
4382 frame_number++, 4416 frame_number++,
4383 Picture::RECORD_NORMALLY, 4417 Picture::RECORD_NORMALLY,
4384 &stats_instrumentation); 4418 &stats_instrumentation);
4385 4419
4386 scoped_refptr<PicturePileImpl> pending_pile = 4420 scoped_refptr<PicturePileImpl> pending_pile =
4387 PicturePileImpl::CreateFromOther(pile); 4421 PicturePileImpl::CreateFromOther(pile);
4388 4422
4389 SetupPendingTree(pending_pile); 4423 SetupPendingTree(pending_pile);
4390 ActivateTree(); 4424 ActivateTree();
4391 4425
4426 active_layer_->set_fixed_tile_size(tile_size);
4427 host_impl_.active_tree()->UpdateDrawProperties();
4392 if (test_for_solid) { 4428 if (test_for_solid) {
4393 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 4429 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
4394 } else { 4430 } else {
4395 ASSERT_TRUE(active_layer_->tilings()); 4431 ASSERT_TRUE(active_layer_->tilings());
4396 active_layer_->set_fixed_tile_size(tile_size);
4397 host_impl_.active_tree()->UpdateDrawProperties();
4398 ASSERT_GT(active_layer_->tilings()->num_tilings(), 0u); 4432 ASSERT_GT(active_layer_->tilings()->num_tilings(), 0u);
4399 std::vector<Tile*> tiles = 4433 std::vector<Tile*> tiles =
4400 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); 4434 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting();
4401 EXPECT_FALSE(tiles.empty()); 4435 EXPECT_FALSE(tiles.empty());
4402 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); 4436 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles);
4403 } 4437 }
4404 4438
4405 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 4439 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
4406 AppendQuadsData data; 4440 AppendQuadsData data;
4407 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); 4441 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
4613 result = layer->CalculateTileSize(gfx::Size(447, 400)); 4647 result = layer->CalculateTileSize(gfx::Size(447, 400));
4614 EXPECT_EQ(result.width(), 448); 4648 EXPECT_EQ(result.width(), 448);
4615 EXPECT_EQ(result.height(), 448); 4649 EXPECT_EQ(result.height(), 448);
4616 result = layer->CalculateTileSize(gfx::Size(500, 499)); 4650 result = layer->CalculateTileSize(gfx::Size(500, 499));
4617 EXPECT_EQ(result.width(), 512); 4651 EXPECT_EQ(result.width(), 512);
4618 EXPECT_EQ(result.height(), 500 + 2); 4652 EXPECT_EQ(result.height(), 500 + 2);
4619 } 4653 }
4620 4654
4621 } // namespace 4655 } // namespace
4622 } // namespace cc 4656 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/layers/solid_color_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698