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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 } | 1409 } |
1410 } | 1410 } |
1411 | 1411 |
1412 TEST_F(TileManagerTilePriorityQueueTest, NoRasterTasksforSolidColorTiles) { | 1412 TEST_F(TileManagerTilePriorityQueueTest, NoRasterTasksforSolidColorTiles) { |
1413 gfx::Size size(10, 10); | 1413 gfx::Size size(10, 10); |
1414 const gfx::Size layer_bounds(1000, 1000); | 1414 const gfx::Size layer_bounds(1000, 1000); |
1415 | 1415 |
1416 std::unique_ptr<FakeRecordingSource> recording_source = | 1416 std::unique_ptr<FakeRecordingSource> recording_source = |
1417 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); | 1417 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); |
1418 | 1418 |
1419 SkPaint solid_paint; | 1419 PaintFlags solid_paint; |
1420 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); | 1420 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); |
1421 solid_paint.setColor(solid_color); | 1421 solid_paint.setColor(solid_color); |
1422 recording_source->add_draw_rect_with_paint(gfx::Rect(layer_bounds), | 1422 recording_source->add_draw_rect_with_paint(gfx::Rect(layer_bounds), |
1423 solid_paint); | 1423 solid_paint); |
1424 | 1424 |
1425 // Create non solid tile as well, otherwise tilings wouldnt be created. | 1425 // Create non solid tile as well, otherwise tilings wouldnt be created. |
1426 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); | 1426 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); |
1427 SkPaint non_solid_paint; | 1427 PaintFlags non_solid_paint; |
1428 non_solid_paint.setColor(non_solid_color); | 1428 non_solid_paint.setColor(non_solid_color); |
1429 | 1429 |
1430 recording_source->add_draw_rect_with_paint(gfx::Rect(0, 0, 10, 10), | 1430 recording_source->add_draw_rect_with_paint(gfx::Rect(0, 0, 10, 10), |
1431 non_solid_paint); | 1431 non_solid_paint); |
1432 recording_source->Rerecord(); | 1432 recording_source->Rerecord(); |
1433 | 1433 |
1434 scoped_refptr<RasterSource> raster_source = | 1434 scoped_refptr<RasterSource> raster_source = |
1435 RasterSource::CreateFromRecordingSource(recording_source.get(), false); | 1435 RasterSource::CreateFromRecordingSource(recording_source.get(), false); |
1436 | 1436 |
1437 FakePictureLayerTilingClient tiling_client; | 1437 FakePictureLayerTilingClient tiling_client; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 SkSurface::MakeRasterN32Premul(size.width(), size.height()); | 1604 SkSurface::MakeRasterN32Premul(size.width(), size.height()); |
1605 ASSERT_NE(surface, nullptr); | 1605 ASSERT_NE(surface, nullptr); |
1606 surface->getCanvas()->clear(SK_ColorBLUE); | 1606 surface->getCanvas()->clear(SK_ColorBLUE); |
1607 sk_sp<SkImage> blue_image = surface->makeImageSnapshot(); | 1607 sk_sp<SkImage> blue_image = surface->makeImageSnapshot(); |
1608 | 1608 |
1609 std::unique_ptr<FakeRecordingSource> recording_source = | 1609 std::unique_ptr<FakeRecordingSource> recording_source = |
1610 FakeRecordingSource::CreateFilledRecordingSource(size); | 1610 FakeRecordingSource::CreateFilledRecordingSource(size); |
1611 recording_source->SetBackgroundColor(SK_ColorTRANSPARENT); | 1611 recording_source->SetBackgroundColor(SK_ColorTRANSPARENT); |
1612 recording_source->SetRequiresClear(true); | 1612 recording_source->SetRequiresClear(true); |
1613 recording_source->SetClearCanvasWithDebugColor(false); | 1613 recording_source->SetClearCanvasWithDebugColor(false); |
1614 SkPaint paint; | 1614 PaintFlags paint; |
1615 paint.setColor(SK_ColorGREEN); | 1615 paint.setColor(SK_ColorGREEN); |
1616 recording_source->add_draw_rect_with_paint(gfx::Rect(size), paint); | 1616 recording_source->add_draw_rect_with_paint(gfx::Rect(size), paint); |
1617 recording_source->add_draw_image(std::move(blue_image), gfx::Point()); | 1617 recording_source->add_draw_image(std::move(blue_image), gfx::Point()); |
1618 recording_source->Rerecord(); | 1618 recording_source->Rerecord(); |
1619 scoped_refptr<RasterSource> raster = | 1619 scoped_refptr<RasterSource> raster = |
1620 RasterSource::CreateFromRecordingSource(recording_source.get(), false); | 1620 RasterSource::CreateFromRecordingSource(recording_source.get(), false); |
1621 | 1621 |
1622 FakePictureLayerTilingClient tiling_client; | 1622 FakePictureLayerTilingClient tiling_client; |
1623 tiling_client.SetTileSize(size); | 1623 tiling_client.SetTileSize(size); |
1624 | 1624 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 TEST_F(ActivationTasksDoNotBlockReadyToDrawTest, | 1696 TEST_F(ActivationTasksDoNotBlockReadyToDrawTest, |
1697 ActivationTasksDoNotBlockReadyToDraw) { | 1697 ActivationTasksDoNotBlockReadyToDraw) { |
1698 const gfx::Size layer_bounds(1000, 1000); | 1698 const gfx::Size layer_bounds(1000, 1000); |
1699 | 1699 |
1700 EXPECT_TRUE(host_impl()->use_gpu_rasterization()); | 1700 EXPECT_TRUE(host_impl()->use_gpu_rasterization()); |
1701 | 1701 |
1702 // Active tree has no non-solid tiles, so it will generate no tile tasks. | 1702 // Active tree has no non-solid tiles, so it will generate no tile tasks. |
1703 std::unique_ptr<FakeRecordingSource> active_tree_recording_source = | 1703 std::unique_ptr<FakeRecordingSource> active_tree_recording_source = |
1704 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); | 1704 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); |
1705 | 1705 |
1706 SkPaint solid_paint; | 1706 PaintFlags solid_paint; |
1707 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); | 1707 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); |
1708 solid_paint.setColor(solid_color); | 1708 solid_paint.setColor(solid_color); |
1709 active_tree_recording_source->add_draw_rect_with_paint( | 1709 active_tree_recording_source->add_draw_rect_with_paint( |
1710 gfx::Rect(layer_bounds), solid_paint); | 1710 gfx::Rect(layer_bounds), solid_paint); |
1711 | 1711 |
1712 active_tree_recording_source->Rerecord(); | 1712 active_tree_recording_source->Rerecord(); |
1713 | 1713 |
1714 // Pending tree has non-solid tiles, so it will generate tile tasks. | 1714 // Pending tree has non-solid tiles, so it will generate tile tasks. |
1715 std::unique_ptr<FakeRecordingSource> pending_tree_recording_source = | 1715 std::unique_ptr<FakeRecordingSource> pending_tree_recording_source = |
1716 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); | 1716 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); |
1717 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); | 1717 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); |
1718 SkPaint non_solid_paint; | 1718 PaintFlags non_solid_paint; |
1719 non_solid_paint.setColor(non_solid_color); | 1719 non_solid_paint.setColor(non_solid_color); |
1720 | 1720 |
1721 pending_tree_recording_source->add_draw_rect_with_paint( | 1721 pending_tree_recording_source->add_draw_rect_with_paint( |
1722 gfx::Rect(5, 5, 10, 10), non_solid_paint); | 1722 gfx::Rect(5, 5, 10, 10), non_solid_paint); |
1723 pending_tree_recording_source->Rerecord(); | 1723 pending_tree_recording_source->Rerecord(); |
1724 | 1724 |
1725 scoped_refptr<RasterSource> active_tree_raster_source = | 1725 scoped_refptr<RasterSource> active_tree_raster_source = |
1726 RasterSource::CreateFromRecordingSource( | 1726 RasterSource::CreateFromRecordingSource( |
1727 active_tree_recording_source.get(), false); | 1727 active_tree_recording_source.get(), false); |
1728 scoped_refptr<RasterSource> pending_tree_raster_source = | 1728 scoped_refptr<RasterSource> pending_tree_raster_source = |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1904 } | 1904 } |
1905 | 1905 |
1906 // Ensures that the tile manager does not attempt to reuse tiles when partial | 1906 // Ensures that the tile manager does not attempt to reuse tiles when partial |
1907 // raster is disabled. | 1907 // raster is disabled. |
1908 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { | 1908 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { |
1909 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); | 1909 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); |
1910 } | 1910 } |
1911 | 1911 |
1912 } // namespace | 1912 } // namespace |
1913 } // namespace cc | 1913 } // namespace cc |
OLD | NEW |