Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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(10, 10); | |
| 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 recording_source->Rerecord(); | |
| 1468 | |
| 1469 scoped_refptr<DisplayListRasterSource> raster_source = | |
| 1470 DisplayListRasterSource::CreateFromDisplayListRecordingSource( | |
| 1471 recording_source.get(), false); | |
| 1472 | |
| 1473 FakePictureLayerTilingClient tiling_client; | |
| 1474 tiling_client.SetTileSize(size); | |
| 1475 | |
| 1476 scoped_ptr<PictureLayerImpl> layer_impl = | |
| 1477 PictureLayerImpl::Create(host_impl_.active_tree(), 1, false, nullptr); | |
| 1478 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set(); | |
| 1479 | |
| 1480 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); | |
|
sohanjg
2016/01/07 12:32:16
this causes a dcheck fail for solid color raster s
| |
| 1481 tiling->set_resolution(HIGH_RESOLUTION); | |
| 1482 tiling->CreateAllTilesForTesting(); | |
| 1483 tiling->SetTilePriorityRectsForTesting(gfx::Rect(size), // Visible rect. | |
| 1484 gfx::Rect(size), // Skewport rect. | |
| 1485 gfx::Rect(size), // Soon rect. | |
| 1486 gfx::Rect(size)); // Eventually rect. | |
| 1487 | |
| 1488 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state()); | |
| 1489 | |
| 1490 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); | |
| 1491 for (size_t tile_idx = 0; tile_idx < tiles.size(); ++tile_idx) { | |
| 1492 Tile* tile = tiles[tile_idx]; | |
| 1493 EXPECT_FALSE(tile->HasRasterTask()); | |
| 1494 EXPECT_EQ(TileDrawInfo::SOLID_COLOR_MODE, tile->draw_info().mode()); | |
| 1495 EXPECT_EQ(solid_color, tile->draw_info().solid_color()); | |
| 1496 } | |
| 1497 } | |
| 1498 | |
| 1455 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest. | 1499 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest. |
| 1456 class TileManagerTest : public testing::Test { | 1500 class TileManagerTest : public testing::Test { |
| 1457 public: | 1501 public: |
| 1458 TileManagerTest() | 1502 TileManagerTest() |
| 1459 : output_surface_(FakeOutputSurface::CreateSoftware( | 1503 : output_surface_(FakeOutputSurface::CreateSoftware( |
| 1460 make_scoped_ptr(new SoftwareOutputDevice))) {} | 1504 make_scoped_ptr(new SoftwareOutputDevice))) {} |
| 1461 | 1505 |
| 1462 void SetUp() override { | 1506 void SetUp() override { |
| 1463 LayerTreeSettingsForTesting settings; | 1507 LayerTreeSettingsForTesting settings; |
| 1464 CustomizeSettings(&settings); | 1508 CustomizeSettings(&settings); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1896 | 1940 |
| 1897 // Ensures that the tile manager does not attempt to reuse tiles when partial | 1941 // Ensures that the tile manager does not attempt to reuse tiles when partial |
| 1898 // raster is disabled. | 1942 // raster is disabled. |
| 1899 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { | 1943 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { |
| 1900 RunPartialRasterCheck(std::move(host_impl_), | 1944 RunPartialRasterCheck(std::move(host_impl_), |
| 1901 false /* partial_raster_enabled */); | 1945 false /* partial_raster_enabled */); |
| 1902 } | 1946 } |
| 1903 | 1947 |
| 1904 } // namespace | 1948 } // namespace |
| 1905 } // namespace cc | 1949 } // namespace cc |
| OLD | NEW |