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

Side by Side Diff: cc/tiles/tile_manager_unittest.cc

Issue 1531013004: cc: Do solid color analysis before scheduling tiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test updated. Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « cc/tiles/tile_manager.cc ('k') | no next file » | 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "cc/playback/display_list_raster_source.h" 10 #include "cc/playback/display_list_raster_source.h"
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 non_intersecting_rect, // Visible rect. 1445 non_intersecting_rect, // Visible rect.
1446 non_intersecting_rect, // Skewport rect. 1446 non_intersecting_rect, // Skewport rect.
1447 non_intersecting_rect, // Soon rect. 1447 non_intersecting_rect, // Soon rect.
1448 intersecting_rect); // Eventually rect. 1448 intersecting_rect); // Eventually rect.
1449 scoped_ptr<TilingSetRasterQueueAll> queue( 1449 scoped_ptr<TilingSetRasterQueueAll> queue(
1450 new TilingSetRasterQueueAll(tiling_set.get(), false)); 1450 new TilingSetRasterQueueAll(tiling_set.get(), false));
1451 EXPECT_FALSE(queue->IsEmpty()); 1451 EXPECT_FALSE(queue->IsEmpty());
1452 } 1452 }
1453 } 1453 }
1454 1454
1455 TEST_F(TileManagerTilePriorityQueueTest, NoRasterTasksforSolidColorTiles) {
1456 gfx::Size size(10, 10);
1457 const gfx::Size layer_bounds(1000, 1000);
1458
1459 scoped_ptr<FakeDisplayListRecordingSource> recording_source =
1460 FakeDisplayListRecordingSource::CreateFilledRecordingSource(layer_bounds);
1461
1462 SkPaint solid_paint;
1463 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34);
1464 solid_paint.setColor(solid_color);
1465 recording_source->add_draw_rect_with_paint(gfx::Rect(layer_bounds),
1466 solid_paint);
1467
1468 // Create non solid tile as well, otherwise tilings wouldnt be created.
1469 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67);
1470 SkPaint non_solid_paint;
1471 non_solid_paint.setColor(non_solid_color);
1472
1473 recording_source->add_draw_rect_with_paint(gfx::Rect(0, 0, 10, 10),
1474 non_solid_paint);
1475 recording_source->Rerecord();
1476
1477 scoped_refptr<DisplayListRasterSource> raster_source =
1478 DisplayListRasterSource::CreateFromDisplayListRecordingSource(
1479 recording_source.get(), false);
1480
1481 FakePictureLayerTilingClient tiling_client;
1482 tiling_client.SetTileSize(size);
1483
1484 scoped_ptr<PictureLayerImpl> layer_impl =
1485 PictureLayerImpl::Create(host_impl_.active_tree(), 1, false, nullptr);
1486 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set();
1487
1488 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source);
1489 tiling->set_resolution(HIGH_RESOLUTION);
1490 tiling->CreateAllTilesForTesting();
1491 tiling->SetTilePriorityRectsForTesting(
1492 gfx::Rect(layer_bounds), // Visible rect.
1493 gfx::Rect(layer_bounds), // Skewport rect.
1494 gfx::Rect(layer_bounds), // Soon rect.
1495 gfx::Rect(layer_bounds)); // Eventually rect.
1496
1497 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state());
1498
1499 std::vector<Tile*> tiles = tiling->AllTilesForTesting();
1500 for (size_t tile_idx = 0; tile_idx < tiles.size(); ++tile_idx) {
1501 Tile* tile = tiles[tile_idx];
1502 if (tile->id() == 1) {
1503 // Non-solid tile.
1504 EXPECT_TRUE(tile->HasRasterTask());
1505 EXPECT_EQ(TileDrawInfo::RESOURCE_MODE, tile->draw_info().mode());
1506 } else {
1507 EXPECT_FALSE(tile->HasRasterTask());
1508 EXPECT_EQ(TileDrawInfo::SOLID_COLOR_MODE, tile->draw_info().mode());
1509 EXPECT_EQ(solid_color, tile->draw_info().solid_color());
1510 }
1511 }
1512 }
1513
1455 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest. 1514 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest.
1456 class TileManagerTest : public testing::Test { 1515 class TileManagerTest : public testing::Test {
1457 public: 1516 public:
1458 TileManagerTest() 1517 TileManagerTest()
1459 : output_surface_(FakeOutputSurface::CreateSoftware( 1518 : output_surface_(FakeOutputSurface::CreateSoftware(
1460 make_scoped_ptr(new SoftwareOutputDevice))) {} 1519 make_scoped_ptr(new SoftwareOutputDevice))) {}
1461 1520
1462 void SetUp() override { 1521 void SetUp() override {
1463 LayerTreeSettingsForTesting settings; 1522 LayerTreeSettingsForTesting settings;
1464 CustomizeSettings(&settings); 1523 CustomizeSettings(&settings);
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 1955
1897 // Ensures that the tile manager does not attempt to reuse tiles when partial 1956 // Ensures that the tile manager does not attempt to reuse tiles when partial
1898 // raster is disabled. 1957 // raster is disabled.
1899 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { 1958 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) {
1900 RunPartialRasterCheck(std::move(host_impl_), 1959 RunPartialRasterCheck(std::move(host_impl_),
1901 false /* partial_raster_enabled */); 1960 false /* partial_raster_enabled */);
1902 } 1961 }
1903 1962
1904 } // namespace 1963 } // namespace
1905 } // namespace cc 1964 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698