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

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

Issue 2678903003: cc: Clean up naming of paint-related identifiers (Closed)
Patch Set: Created 3 years, 10 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
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/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
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 PaintFlags solid_paint; 1426 PaintFlags solid_flags;
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_flags.setColor(solid_color);
1429 recording_source->add_draw_rect_with_paint(gfx::Rect(layer_bounds), 1429 recording_source->add_draw_rect_with_flags(gfx::Rect(layer_bounds),
1430 solid_paint); 1430 solid_flags);
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 PaintFlags non_solid_paint; 1434 PaintFlags non_solid_flags;
1435 non_solid_paint.setColor(non_solid_color); 1435 non_solid_flags.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_flags(gfx::Rect(0, 0, 10, 10),
1438 non_solid_paint); 1438 non_solid_flags);
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;
1445 tiling_client.SetTileSize(size); 1445 tiling_client.SetTileSize(size);
1446 1446
1447 std::unique_ptr<PictureLayerImpl> layer_impl = 1447 std::unique_ptr<PictureLayerImpl> layer_impl =
1448 PictureLayerImpl::Create(host_impl()->active_tree(), 1, false); 1448 PictureLayerImpl::Create(host_impl()->active_tree(), 1, false);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 PaintFlags paint; 1639 PaintFlags flags;
1640 paint.setColor(SK_ColorGREEN); 1640 flags.setColor(SK_ColorGREEN);
1641 recording_source->add_draw_rect_with_paint(gfx::Rect(size), paint); 1641 recording_source->add_draw_rect_with_flags(gfx::Rect(size), flags);
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
1650 std::unique_ptr<PictureLayerImpl> layer = 1650 std::unique_ptr<PictureLayerImpl> layer =
1651 PictureLayerImpl::Create(host_impl()->active_tree(), 1, false); 1651 PictureLayerImpl::Create(host_impl()->active_tree(), 1, false);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 PaintFlags solid_paint; 1731 PaintFlags solid_flags;
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_flags.setColor(solid_color);
1734 active_tree_recording_source->add_draw_rect_with_paint( 1734 active_tree_recording_source->add_draw_rect_with_flags(
1735 gfx::Rect(layer_bounds), solid_paint); 1735 gfx::Rect(layer_bounds), solid_flags);
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 PaintFlags non_solid_paint; 1743 PaintFlags non_solid_flags;
1744 non_solid_paint.setColor(non_solid_color); 1744 non_solid_flags.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_flags(
1747 gfx::Rect(5, 5, 10, 10), non_solid_paint); 1747 gfx::Rect(5, 5, 10, 10), non_solid_flags);
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 =
1754 RasterSource::CreateFromRecordingSource( 1754 RasterSource::CreateFromRecordingSource(
1755 pending_tree_recording_source.get(), false); 1755 pending_tree_recording_source.get(), false);
1756 1756
1757 SetupTrees(pending_tree_raster_source, active_tree_raster_source); 1757 SetupTrees(pending_tree_raster_source, active_tree_raster_source);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 void SetUp() override { 1974 void SetUp() override {
1975 TileManagerTest::SetUp(); 1975 TileManagerTest::SetUp();
1976 host_impl()->tile_manager()->SetRasterBufferProviderForTesting( 1976 host_impl()->tile_manager()->SetRasterBufferProviderForTesting(
1977 &mock_raster_buffer_provider_); 1977 &mock_raster_buffer_provider_);
1978 1978
1979 const gfx::Size layer_bounds(1000, 1000); 1979 const gfx::Size layer_bounds(1000, 1000);
1980 1980
1981 solid_color_recording_source_ = 1981 solid_color_recording_source_ =
1982 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); 1982 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds);
1983 1983
1984 SkPaint solid_paint; 1984 PaintFlags solid_flags;
1985 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); 1985 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34);
1986 solid_paint.setColor(solid_color); 1986 solid_flags.setColor(solid_color);
1987 solid_color_recording_source_->add_draw_rect_with_paint( 1987 solid_color_recording_source_->add_draw_rect_with_flags(
1988 gfx::Rect(layer_bounds), solid_paint); 1988 gfx::Rect(layer_bounds), solid_flags);
1989 1989
1990 solid_color_recording_source_->Rerecord(); 1990 solid_color_recording_source_->Rerecord();
1991 1991
1992 recording_source_ = 1992 recording_source_ =
1993 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); 1993 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds);
1994 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); 1994 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67);
1995 SkPaint non_solid_paint; 1995 PaintFlags non_solid_flags;
1996 non_solid_paint.setColor(non_solid_color); 1996 non_solid_flags.setColor(non_solid_color);
1997 1997
1998 for (int i = 0; i < 100; ++i) { 1998 for (int i = 0; i < 100; ++i) {
1999 for (int j = 0; j < 100; ++j) { 1999 for (int j = 0; j < 100; ++j) {
2000 recording_source_->add_draw_rect_with_paint( 2000 recording_source_->add_draw_rect_with_flags(
2001 gfx::Rect(10 * i, 10 * j, 5, 5), non_solid_paint); 2001 gfx::Rect(10 * i, 10 * j, 5, 5), non_solid_flags);
2002 } 2002 }
2003 } 2003 }
2004 recording_source_->Rerecord(); 2004 recording_source_->Rerecord();
2005 } 2005 }
2006 2006
2007 LayerTreeSettings CreateSettings() override { 2007 LayerTreeSettings CreateSettings() override {
2008 LayerTreeSettingsForTesting settings; 2008 LayerTreeSettingsForTesting settings;
2009 settings.renderer_settings.buffer_to_texture_target_map = 2009 settings.renderer_settings.buffer_to_texture_target_map =
2010 DefaultBufferToTextureTargetMapForTesting(); 2010 DefaultBufferToTextureTargetMapForTesting();
2011 return settings; 2011 return settings;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698