| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "cc/base/lap_timer.h" | 7 #include "cc/base/lap_timer.h" |
| 8 #include "cc/paint/draw_image.h" | 8 #include "cc/paint/draw_image.h" |
| 9 #include "cc/raster/tile_task.h" | 9 #include "cc/raster/tile_task.h" |
| 10 #include "cc/tiles/software_image_decode_cache.h" | 10 #include "cc/tiles/software_image_decode_cache.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 std::make_pair(2.f, 2.f), std::make_pair(0.5f, 1.5f)}; | 50 std::make_pair(2.f, 2.f), std::make_pair(0.5f, 1.5f)}; |
| 51 | 51 |
| 52 std::vector<DrawImage> images; | 52 std::vector<DrawImage> images; |
| 53 for (auto& quality : qualities) { | 53 for (auto& quality : qualities) { |
| 54 for (auto& rect_subrect : image_rect_subrect) { | 54 for (auto& rect_subrect : image_rect_subrect) { |
| 55 auto& rect = rect_subrect.first; | 55 auto& rect = rect_subrect.first; |
| 56 auto& subrect = rect_subrect.second; | 56 auto& subrect = rect_subrect.second; |
| 57 for (auto& scale : scales) { | 57 for (auto& scale : scales) { |
| 58 images.emplace_back( | 58 images.emplace_back( |
| 59 CreateImage(rect.width(), rect.height()), subrect, quality, | 59 CreateImage(rect.width(), rect.height()), subrect, quality, |
| 60 CreateMatrix(SkSize::Make(scale.first, scale.second))); | 60 CreateMatrix(SkSize::Make(scale.first, scale.second)), |
| 61 gfx::ColorSpace()); |
| 61 } | 62 } |
| 62 } | 63 } |
| 63 } | 64 } |
| 64 | 65 |
| 65 timer_.Reset(); | 66 timer_.Reset(); |
| 66 do { | 67 do { |
| 67 for (auto& image : images) | 68 for (auto& image : images) |
| 68 ImageDecodeCacheKey::FromDrawImage(image); | 69 ImageDecodeCacheKey::FromDrawImage(image); |
| 69 timer_.NextLap(); | 70 timer_.NextLap(); |
| 70 } while (!timer_.HasTimeLimitExpired()); | 71 } while (!timer_.HasTimeLimitExpired()); |
| 71 | 72 |
| 72 perf_test::PrintResult("software_image_decode_cache_fromdrawimage", "", | 73 perf_test::PrintResult("software_image_decode_cache_fromdrawimage", "", |
| 73 "result", timer_.LapsPerSecond(), "runs/s", true); | 74 "result", timer_.LapsPerSecond(), "runs/s", true); |
| 74 } | 75 } |
| 75 | 76 |
| 76 private: | 77 private: |
| 77 LapTimer timer_; | 78 LapTimer timer_; |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 TEST_F(SoftwareImageDecodeCachePerfTest, FromDrawImage) { | 81 TEST_F(SoftwareImageDecodeCachePerfTest, FromDrawImage) { |
| 81 RunFromImage(); | 82 RunFromImage(); |
| 82 } | 83 } |
| 83 | 84 |
| 84 } // namespace | 85 } // namespace |
| 85 } // namespace cc | 86 } // namespace cc |
| OLD | NEW |