OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/playback/picture_pile_impl.h" | 5 #include "cc/playback/picture_pile_impl.h" |
6 | 6 |
7 #include "cc/debug/lap_timer.h" | 7 #include "cc/debug/lap_timer.h" |
8 #include "cc/test/fake_picture_pile_impl.h" | 8 #include "cc/test/fake_picture_pile_impl.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "testing/perf/perf_test.h" | 10 #include "testing/perf/perf_test.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 gfx::Size(kTileSize, kTileSize), gfx::Size(kLayerSize, kLayerSize)); | 48 gfx::Size(kTileSize, kTileSize), gfx::Size(kLayerSize, kLayerSize)); |
49 // Content rect that will align with top-left tile at scale 1.0. | 49 // Content rect that will align with top-left tile at scale 1.0. |
50 gfx::Rect content_rect(0, 0, kTileSize, kTileSize); | 50 gfx::Rect content_rect(0, 0, kTileSize, kTileSize); |
51 | 51 |
52 SkBitmap bitmap; | 52 SkBitmap bitmap; |
53 bitmap.allocN32Pixels(1, 1); | 53 bitmap.allocN32Pixels(1, 1); |
54 SkCanvas canvas(bitmap); | 54 SkCanvas canvas(bitmap); |
55 | 55 |
56 timer_.Reset(); | 56 timer_.Reset(); |
57 do { | 57 do { |
58 pile->PlaybackToCanvas(&canvas, content_rect, contents_scale); | 58 pile->PlaybackToCanvas(&canvas, content_rect, content_rect, |
| 59 contents_scale); |
59 timer_.NextLap(); | 60 timer_.NextLap(); |
60 } while (!timer_.HasTimeLimitExpired()); | 61 } while (!timer_.HasTimeLimitExpired()); |
61 | 62 |
62 perf_test::PrintResult( | 63 perf_test::PrintResult( |
63 "raster", "", test_name, timer_.LapsPerSecond(), "runs/s", true); | 64 "raster", "", test_name, timer_.LapsPerSecond(), "runs/s", true); |
64 } | 65 } |
65 | 66 |
66 private: | 67 private: |
67 LapTimer timer_; | 68 LapTimer timer_; |
68 }; | 69 }; |
69 | 70 |
70 TEST_F(PicturePileImplPerfTest, Analyze) { | 71 TEST_F(PicturePileImplPerfTest, Analyze) { |
71 RunAnalyzeTest("1", 1.0f); | 72 RunAnalyzeTest("1", 1.0f); |
72 RunAnalyzeTest("4", 0.5f); | 73 RunAnalyzeTest("4", 0.5f); |
73 RunAnalyzeTest("100", 0.1f); | 74 RunAnalyzeTest("100", 0.1f); |
74 } | 75 } |
75 | 76 |
76 TEST_F(PicturePileImplPerfTest, Raster) { | 77 TEST_F(PicturePileImplPerfTest, Raster) { |
77 RunRasterTest("1", 1.0f); | 78 RunRasterTest("1", 1.0f); |
78 RunRasterTest("4", 0.5f); | 79 RunRasterTest("4", 0.5f); |
79 RunRasterTest("100", 0.1f); | 80 RunRasterTest("100", 0.1f); |
80 } | 81 } |
81 | 82 |
82 } // namespace | 83 } // namespace |
83 } // namespace cc | 84 } // namespace cc |
OLD | NEW |