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

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

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@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/tiled_layer_impl_unittest.cc » ('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 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 SetupTrees(pending_pile, active_pile); 1460 SetupTrees(pending_pile, active_pile);
1461 1461
1462 active_layer_->draw_properties().visible_content_rect = visible_rect; 1462 active_layer_->draw_properties().visible_content_rect = visible_rect;
1463 1463
1464 AppendQuadsData data; 1464 AppendQuadsData data;
1465 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); 1465 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr);
1466 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); 1466 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data);
1467 active_layer_->DidDraw(nullptr); 1467 active_layer_->DidDraw(nullptr);
1468 1468
1469 Region remaining = visible_rect; 1469 Region remaining = visible_rect;
1470 for (auto& quad : render_pass->quad_list) { 1470 for (const auto& quad : render_pass->quad_list) {
1471 EXPECT_TRUE(visible_rect.Contains(quad.rect)); 1471 EXPECT_TRUE(visible_rect.Contains(quad->rect));
1472 EXPECT_TRUE(remaining.Contains(quad.rect)); 1472 EXPECT_TRUE(remaining.Contains(quad->rect));
1473 remaining.Subtract(quad.rect); 1473 remaining.Subtract(quad->rect);
1474 } 1474 }
1475 1475
1476 EXPECT_TRUE(remaining.IsEmpty()); 1476 EXPECT_TRUE(remaining.IsEmpty());
1477 } 1477 }
1478 1478
1479 TEST_F(PictureLayerImplTest, TileScalesWithSolidColorPile) {
1480 gfx::Size layer_bounds(200, 200);
1481 gfx::Size tile_size(host_impl_.settings().default_tile_size);
1482 scoped_refptr<FakePicturePileImpl> pending_pile =
1483 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
1484 tile_size, layer_bounds);
1485 scoped_refptr<FakePicturePileImpl> active_pile =
1486 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
1487 tile_size, layer_bounds);
1488
1489 pending_pile->set_is_solid_color(false);
1490 active_pile->set_is_solid_color(true);
1491 SetupTrees(pending_pile, active_pile);
1492 // Solid color layer should not have tilings.
1493 ASSERT_FALSE(active_layer_->CanHaveTilings());
1494
1495 // Update properties with solid color pile should not allow tilings at any
1496 // scale.
1497 host_impl_.active_tree()->UpdateDrawProperties();
1498 EXPECT_FALSE(active_layer_->CanHaveTilings());
1499 EXPECT_EQ(0.f, active_layer_->ideal_contents_scale());
1500
1501 // Push non-solid-color pending pile makes active layer can have tilings.
1502 active_layer_->UpdatePile(pending_pile);
1503 ASSERT_TRUE(active_layer_->CanHaveTilings());
1504
1505 // Update properties with non-solid color pile should allow tilings.
1506 host_impl_.active_tree()->UpdateDrawProperties();
1507 EXPECT_TRUE(active_layer_->CanHaveTilings());
1508 EXPECT_GT(active_layer_->ideal_contents_scale(), 0.f);
1509 }
1510
1479 TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) { 1511 TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) {
1480 gfx::Size tile_size(100, 100); 1512 gfx::Size tile_size(100, 100);
1481 gfx::Size layer_bounds(200, 200); 1513 gfx::Size layer_bounds(200, 200);
1482 1514
1483 scoped_refptr<FakePicturePileImpl> pending_pile = 1515 scoped_refptr<FakePicturePileImpl> pending_pile =
1484 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1516 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1485 SetupPendingTree(pending_pile); 1517 SetupPendingTree(pending_pile);
1486 1518
1487 gfx::Transform transform; 1519 gfx::Transform transform;
1488 gfx::Transform transform_for_tile_priority; 1520 gfx::Transform transform_for_tile_priority;
(...skipping 3215 matching lines...) Expand 10 before | Expand all | Expand 10 after
4704 result = layer->CalculateTileSize(gfx::Size(447, 400)); 4736 result = layer->CalculateTileSize(gfx::Size(447, 400));
4705 EXPECT_EQ(result.width(), 448); 4737 EXPECT_EQ(result.width(), 448);
4706 EXPECT_EQ(result.height(), 448); 4738 EXPECT_EQ(result.height(), 448);
4707 result = layer->CalculateTileSize(gfx::Size(500, 499)); 4739 result = layer->CalculateTileSize(gfx::Size(500, 499));
4708 EXPECT_EQ(result.width(), 512); 4740 EXPECT_EQ(result.width(), 512);
4709 EXPECT_EQ(result.height(), 500 + 2); 4741 EXPECT_EQ(result.height(), 500 + 2);
4710 } 4742 }
4711 4743
4712 } // namespace 4744 } // namespace
4713 } // namespace cc 4745 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/layers/tiled_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698