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

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

Issue 2857923004: cc: Keep PaintImage in DrawImage. (Closed)
Patch Set: addressed comments. Created 3 years, 7 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 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 std::make_pair(1.f, 1.f), std::make_pair(0.5f, 0.5f), 49 std::make_pair(1.f, 1.f), std::make_pair(0.5f, 0.5f),
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 PaintImage(CreateImage(rect.width(), rect.height())), subrect,
60 CreateMatrix(SkSize::Make(scale.first, scale.second)), 60 quality, CreateMatrix(SkSize::Make(scale.first, scale.second)),
61 gfx::ColorSpace()); 61 gfx::ColorSpace());
62 } 62 }
63 } 63 }
64 } 64 }
65 65
66 timer_.Reset(); 66 timer_.Reset();
67 do { 67 do {
68 for (auto& image : images) 68 for (auto& image : images)
69 ImageDecodeCacheKey::FromDrawImage(image); 69 ImageDecodeCacheKey::FromDrawImage(image);
70 timer_.NextLap(); 70 timer_.NextLap();
71 } while (!timer_.HasTimeLimitExpired()); 71 } while (!timer_.HasTimeLimitExpired());
72 72
73 perf_test::PrintResult("software_image_decode_cache_fromdrawimage", "", 73 perf_test::PrintResult("software_image_decode_cache_fromdrawimage", "",
74 "result", timer_.LapsPerSecond(), "runs/s", true); 74 "result", timer_.LapsPerSecond(), "runs/s", true);
75 } 75 }
76 76
77 private: 77 private:
78 LapTimer timer_; 78 LapTimer timer_;
79 }; 79 };
80 80
81 TEST_F(SoftwareImageDecodeCachePerfTest, FromDrawImage) { 81 TEST_F(SoftwareImageDecodeCachePerfTest, FromDrawImage) {
82 RunFromImage(); 82 RunFromImage();
83 } 83 }
84 84
85 } // namespace 85 } // namespace
86 } // namespace cc 86 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698