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/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 } | 1416 } |
1417 } | 1417 } |
1418 | 1418 |
1419 TEST_F(TileManagerTilePriorityQueueTest, NoRasterTasksforSolidColorTiles) { | 1419 TEST_F(TileManagerTilePriorityQueueTest, NoRasterTasksforSolidColorTiles) { |
1420 gfx::Size size(10, 10); | 1420 gfx::Size size(10, 10); |
1421 const gfx::Size layer_bounds(1000, 1000); | 1421 const gfx::Size layer_bounds(1000, 1000); |
1422 | 1422 |
1423 std::unique_ptr<FakeRecordingSource> recording_source = | 1423 std::unique_ptr<FakeRecordingSource> recording_source = |
1424 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); | 1424 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); |
1425 | 1425 |
1426 SkPaint solid_paint; | 1426 PaintFlags solid_paint; |
1427 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); | 1427 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); |
1428 solid_paint.setColor(solid_color); | 1428 solid_paint.setColor(solid_color); |
1429 recording_source->add_draw_rect_with_paint(gfx::Rect(layer_bounds), | 1429 recording_source->add_draw_rect_with_paint(gfx::Rect(layer_bounds), |
1430 solid_paint); | 1430 solid_paint); |
1431 | 1431 |
1432 // Create non solid tile as well, otherwise tilings wouldnt be created. | 1432 // Create non solid tile as well, otherwise tilings wouldnt be created. |
1433 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); | 1433 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); |
1434 SkPaint non_solid_paint; | 1434 PaintFlags non_solid_paint; |
1435 non_solid_paint.setColor(non_solid_color); | 1435 non_solid_paint.setColor(non_solid_color); |
1436 | 1436 |
1437 recording_source->add_draw_rect_with_paint(gfx::Rect(0, 0, 10, 10), | 1437 recording_source->add_draw_rect_with_paint(gfx::Rect(0, 0, 10, 10), |
1438 non_solid_paint); | 1438 non_solid_paint); |
1439 recording_source->Rerecord(); | 1439 recording_source->Rerecord(); |
1440 | 1440 |
1441 scoped_refptr<RasterSource> raster_source = | 1441 scoped_refptr<RasterSource> raster_source = |
1442 RasterSource::CreateFromRecordingSource(recording_source.get(), false); | 1442 RasterSource::CreateFromRecordingSource(recording_source.get(), false); |
1443 | 1443 |
1444 FakePictureLayerTilingClient tiling_client; | 1444 FakePictureLayerTilingClient tiling_client; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 SkSurface::MakeRasterN32Premul(size.width(), size.height()); | 1629 SkSurface::MakeRasterN32Premul(size.width(), size.height()); |
1630 ASSERT_NE(surface, nullptr); | 1630 ASSERT_NE(surface, nullptr); |
1631 surface->getCanvas()->clear(SK_ColorBLUE); | 1631 surface->getCanvas()->clear(SK_ColorBLUE); |
1632 sk_sp<SkImage> blue_image = surface->makeImageSnapshot(); | 1632 sk_sp<SkImage> blue_image = surface->makeImageSnapshot(); |
1633 | 1633 |
1634 std::unique_ptr<FakeRecordingSource> recording_source = | 1634 std::unique_ptr<FakeRecordingSource> recording_source = |
1635 FakeRecordingSource::CreateFilledRecordingSource(size); | 1635 FakeRecordingSource::CreateFilledRecordingSource(size); |
1636 recording_source->SetBackgroundColor(SK_ColorTRANSPARENT); | 1636 recording_source->SetBackgroundColor(SK_ColorTRANSPARENT); |
1637 recording_source->SetRequiresClear(true); | 1637 recording_source->SetRequiresClear(true); |
1638 recording_source->SetClearCanvasWithDebugColor(false); | 1638 recording_source->SetClearCanvasWithDebugColor(false); |
1639 SkPaint paint; | 1639 PaintFlags paint; |
1640 paint.setColor(SK_ColorGREEN); | 1640 paint.setColor(SK_ColorGREEN); |
1641 recording_source->add_draw_rect_with_paint(gfx::Rect(size), paint); | 1641 recording_source->add_draw_rect_with_paint(gfx::Rect(size), paint); |
1642 recording_source->add_draw_image(std::move(blue_image), gfx::Point()); | 1642 recording_source->add_draw_image(std::move(blue_image), gfx::Point()); |
1643 recording_source->Rerecord(); | 1643 recording_source->Rerecord(); |
1644 scoped_refptr<RasterSource> raster = | 1644 scoped_refptr<RasterSource> raster = |
1645 RasterSource::CreateFromRecordingSource(recording_source.get(), false); | 1645 RasterSource::CreateFromRecordingSource(recording_source.get(), false); |
1646 | 1646 |
1647 FakePictureLayerTilingClient tiling_client; | 1647 FakePictureLayerTilingClient tiling_client; |
1648 tiling_client.SetTileSize(size); | 1648 tiling_client.SetTileSize(size); |
1649 | 1649 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 TEST_F(ActivationTasksDoNotBlockReadyToDrawTest, | 1721 TEST_F(ActivationTasksDoNotBlockReadyToDrawTest, |
1722 ActivationTasksDoNotBlockReadyToDraw) { | 1722 ActivationTasksDoNotBlockReadyToDraw) { |
1723 const gfx::Size layer_bounds(1000, 1000); | 1723 const gfx::Size layer_bounds(1000, 1000); |
1724 | 1724 |
1725 EXPECT_TRUE(host_impl()->use_gpu_rasterization()); | 1725 EXPECT_TRUE(host_impl()->use_gpu_rasterization()); |
1726 | 1726 |
1727 // Active tree has no non-solid tiles, so it will generate no tile tasks. | 1727 // Active tree has no non-solid tiles, so it will generate no tile tasks. |
1728 std::unique_ptr<FakeRecordingSource> active_tree_recording_source = | 1728 std::unique_ptr<FakeRecordingSource> active_tree_recording_source = |
1729 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); | 1729 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); |
1730 | 1730 |
1731 SkPaint solid_paint; | 1731 PaintFlags solid_paint; |
1732 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); | 1732 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); |
1733 solid_paint.setColor(solid_color); | 1733 solid_paint.setColor(solid_color); |
1734 active_tree_recording_source->add_draw_rect_with_paint( | 1734 active_tree_recording_source->add_draw_rect_with_paint( |
1735 gfx::Rect(layer_bounds), solid_paint); | 1735 gfx::Rect(layer_bounds), solid_paint); |
1736 | 1736 |
1737 active_tree_recording_source->Rerecord(); | 1737 active_tree_recording_source->Rerecord(); |
1738 | 1738 |
1739 // Pending tree has non-solid tiles, so it will generate tile tasks. | 1739 // Pending tree has non-solid tiles, so it will generate tile tasks. |
1740 std::unique_ptr<FakeRecordingSource> pending_tree_recording_source = | 1740 std::unique_ptr<FakeRecordingSource> pending_tree_recording_source = |
1741 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); | 1741 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); |
1742 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); | 1742 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); |
1743 SkPaint non_solid_paint; | 1743 PaintFlags non_solid_paint; |
1744 non_solid_paint.setColor(non_solid_color); | 1744 non_solid_paint.setColor(non_solid_color); |
1745 | 1745 |
1746 pending_tree_recording_source->add_draw_rect_with_paint( | 1746 pending_tree_recording_source->add_draw_rect_with_paint( |
1747 gfx::Rect(5, 5, 10, 10), non_solid_paint); | 1747 gfx::Rect(5, 5, 10, 10), non_solid_paint); |
1748 pending_tree_recording_source->Rerecord(); | 1748 pending_tree_recording_source->Rerecord(); |
1749 | 1749 |
1750 scoped_refptr<RasterSource> active_tree_raster_source = | 1750 scoped_refptr<RasterSource> active_tree_raster_source = |
1751 RasterSource::CreateFromRecordingSource( | 1751 RasterSource::CreateFromRecordingSource( |
1752 active_tree_recording_source.get(), false); | 1752 active_tree_recording_source.get(), false); |
1753 scoped_refptr<RasterSource> pending_tree_raster_source = | 1753 scoped_refptr<RasterSource> pending_tree_raster_source = |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2258 .WillOnce(Invoke([&run_loop]() { run_loop.Quit(); })); | 2258 .WillOnce(Invoke([&run_loop]() { run_loop.Quit(); })); |
2259 run_loop.Run(); | 2259 run_loop.Run(); |
2260 } | 2260 } |
2261 | 2261 |
2262 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToDraw()); | 2262 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToDraw()); |
2263 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToActivate()); | 2263 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToActivate()); |
2264 } | 2264 } |
2265 | 2265 |
2266 } // namespace | 2266 } // namespace |
2267 } // namespace cc | 2267 } // namespace cc |
OLD | NEW |