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

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

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Re-add ios changes 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/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
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 SkSurface::MakeRasterN32Premul(size.width(), size.height()); 1622 SkSurface::MakeRasterN32Premul(size.width(), size.height());
1623 ASSERT_NE(surface, nullptr); 1623 ASSERT_NE(surface, nullptr);
1624 surface->getCanvas()->clear(SK_ColorBLUE); 1624 surface->getCanvas()->clear(SK_ColorBLUE);
1625 sk_sp<SkImage> blue_image = surface->makeImageSnapshot(); 1625 sk_sp<SkImage> blue_image = surface->makeImageSnapshot();
1626 1626
1627 std::unique_ptr<FakeRecordingSource> recording_source = 1627 std::unique_ptr<FakeRecordingSource> recording_source =
1628 FakeRecordingSource::CreateFilledRecordingSource(size); 1628 FakeRecordingSource::CreateFilledRecordingSource(size);
1629 recording_source->SetBackgroundColor(SK_ColorTRANSPARENT); 1629 recording_source->SetBackgroundColor(SK_ColorTRANSPARENT);
1630 recording_source->SetRequiresClear(true); 1630 recording_source->SetRequiresClear(true);
1631 recording_source->SetClearCanvasWithDebugColor(false); 1631 recording_source->SetClearCanvasWithDebugColor(false);
1632 SkPaint paint; 1632 PaintFlags paint;
1633 paint.setColor(SK_ColorGREEN); 1633 paint.setColor(SK_ColorGREEN);
1634 recording_source->add_draw_rect_with_paint(gfx::Rect(size), paint); 1634 recording_source->add_draw_rect_with_paint(gfx::Rect(size), paint);
1635 recording_source->add_draw_image(std::move(blue_image), gfx::Point()); 1635 recording_source->add_draw_image(std::move(blue_image), gfx::Point());
1636 recording_source->Rerecord(); 1636 recording_source->Rerecord();
1637 scoped_refptr<RasterSource> raster = 1637 scoped_refptr<RasterSource> raster =
1638 RasterSource::CreateFromRecordingSource(recording_source.get(), false); 1638 RasterSource::CreateFromRecordingSource(recording_source.get(), false);
1639 1639
1640 FakePictureLayerTilingClient tiling_client; 1640 FakePictureLayerTilingClient tiling_client;
1641 tiling_client.SetTileSize(size); 1641 tiling_client.SetTileSize(size);
1642 1642
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 TEST_F(ActivationTasksDoNotBlockReadyToDrawTest, 1714 TEST_F(ActivationTasksDoNotBlockReadyToDrawTest,
1715 ActivationTasksDoNotBlockReadyToDraw) { 1715 ActivationTasksDoNotBlockReadyToDraw) {
1716 const gfx::Size layer_bounds(1000, 1000); 1716 const gfx::Size layer_bounds(1000, 1000);
1717 1717
1718 EXPECT_TRUE(host_impl()->use_gpu_rasterization()); 1718 EXPECT_TRUE(host_impl()->use_gpu_rasterization());
1719 1719
1720 // Active tree has no non-solid tiles, so it will generate no tile tasks. 1720 // Active tree has no non-solid tiles, so it will generate no tile tasks.
1721 std::unique_ptr<FakeRecordingSource> active_tree_recording_source = 1721 std::unique_ptr<FakeRecordingSource> active_tree_recording_source =
1722 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); 1722 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds);
1723 1723
1724 SkPaint solid_paint; 1724 PaintFlags solid_paint;
1725 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); 1725 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34);
1726 solid_paint.setColor(solid_color); 1726 solid_paint.setColor(solid_color);
1727 active_tree_recording_source->add_draw_rect_with_paint( 1727 active_tree_recording_source->add_draw_rect_with_paint(
1728 gfx::Rect(layer_bounds), solid_paint); 1728 gfx::Rect(layer_bounds), solid_paint);
1729 1729
1730 active_tree_recording_source->Rerecord(); 1730 active_tree_recording_source->Rerecord();
1731 1731
1732 // Pending tree has non-solid tiles, so it will generate tile tasks. 1732 // Pending tree has non-solid tiles, so it will generate tile tasks.
1733 std::unique_ptr<FakeRecordingSource> pending_tree_recording_source = 1733 std::unique_ptr<FakeRecordingSource> pending_tree_recording_source =
1734 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); 1734 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds);
1735 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); 1735 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67);
1736 SkPaint non_solid_paint; 1736 PaintFlags non_solid_paint;
1737 non_solid_paint.setColor(non_solid_color); 1737 non_solid_paint.setColor(non_solid_color);
1738 1738
1739 pending_tree_recording_source->add_draw_rect_with_paint( 1739 pending_tree_recording_source->add_draw_rect_with_paint(
1740 gfx::Rect(5, 5, 10, 10), non_solid_paint); 1740 gfx::Rect(5, 5, 10, 10), non_solid_paint);
1741 pending_tree_recording_source->Rerecord(); 1741 pending_tree_recording_source->Rerecord();
1742 1742
1743 scoped_refptr<RasterSource> active_tree_raster_source = 1743 scoped_refptr<RasterSource> active_tree_raster_source =
1744 RasterSource::CreateFromRecordingSource( 1744 RasterSource::CreateFromRecordingSource(
1745 active_tree_recording_source.get(), false); 1745 active_tree_recording_source.get(), false);
1746 scoped_refptr<RasterSource> pending_tree_raster_source = 1746 scoped_refptr<RasterSource> pending_tree_raster_source =
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 } 1922 }
1923 1923
1924 // Ensures that the tile manager does not attempt to reuse tiles when partial 1924 // Ensures that the tile manager does not attempt to reuse tiles when partial
1925 // raster is disabled. 1925 // raster is disabled.
1926 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { 1926 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) {
1927 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); 1927 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */);
1928 } 1928 }
1929 1929
1930 } // namespace 1930 } // namespace
1931 } // namespace cc 1931 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698