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

Side by Side Diff: bench/PicturePlaybackBench.cpp

Issue 845623002: Remove SkTileGrid (except for TileGridInfo). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: kill gridSupported Created 5 years, 11 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
« no previous file with comments | « no previous file | dm/DMCpuGMTask.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "Benchmark.h" 7 #include "Benchmark.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkColor.h" 9 #include "SkColor.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 /////////////////////////////////////////////////////////////////////////////// 138 ///////////////////////////////////////////////////////////////////////////////
139 139
140 DEF_BENCH( return new TextPlaybackBench(); ) 140 DEF_BENCH( return new TextPlaybackBench(); )
141 DEF_BENCH( return new PosTextPlaybackBench(true); ) 141 DEF_BENCH( return new PosTextPlaybackBench(true); )
142 DEF_BENCH( return new PosTextPlaybackBench(false); ) 142 DEF_BENCH( return new PosTextPlaybackBench(false); )
143 143
144 // Chrome draws into small tiles with impl-side painting. 144 // Chrome draws into small tiles with impl-side painting.
145 // This benchmark measures the relative performance of our bounding-box hierarch ies, 145 // This benchmark measures the relative performance of our bounding-box hierarch ies,
146 // both when querying tiles perfectly and when not. 146 // both when querying tiles perfectly and when not.
147 enum BBH { kNone, kRTree, kTileGrid }; 147 enum BBH { kNone, kRTree };
148 enum Mode { kTiled, kRandom }; 148 enum Mode { kTiled, kRandom };
149 class TiledPlaybackBench : public Benchmark { 149 class TiledPlaybackBench : public Benchmark {
150 public: 150 public:
151 TiledPlaybackBench(BBH bbh, Mode mode) : fBBH(bbh), fMode(mode), fName("tile d_playback") { 151 TiledPlaybackBench(BBH bbh, Mode mode) : fBBH(bbh), fMode(mode), fName("tile d_playback") {
152 switch (fBBH) { 152 switch (fBBH) {
153 case kNone: fName.append("_none" ); break; 153 case kNone: fName.append("_none" ); break;
154 case kRTree: fName.append("_rtree" ); break; 154 case kRTree: fName.append("_rtree" ); break;
155 case kTileGrid: fName.append("_tilegrid"); break;
156 } 155 }
157 switch (fMode) { 156 switch (fMode) {
158 case kTiled: fName.append("_tiled" ); break; 157 case kTiled: fName.append("_tiled" ); break;
159 case kRandom: fName.append("_random"); break; 158 case kRandom: fName.append("_random"); break;
160 } 159 }
161 } 160 }
162 161
163 virtual const char* onGetName() SK_OVERRIDE { return fName.c_str(); } 162 virtual const char* onGetName() SK_OVERRIDE { return fName.c_str(); }
164 virtual SkIPoint onGetSize() SK_OVERRIDE { return SkIPoint::Make(1024,1024); } 163 virtual SkIPoint onGetSize() SK_OVERRIDE { return SkIPoint::Make(1024,1024); }
165 164
166 virtual void onPreDraw() SK_OVERRIDE { 165 virtual void onPreDraw() SK_OVERRIDE {
167 SkTileGridFactory::TileGridInfo info = { { 256, 256 }, {0,0}, {0,0} };
168 SkAutoTDelete<SkBBHFactory> factory; 166 SkAutoTDelete<SkBBHFactory> factory;
169 switch (fBBH) { 167 switch (fBBH) {
170 case kNone: break; 168 case kNone: break;
171 case kRTree: factory.reset(new SkRTreeFactory); break; 169 case kRTree: factory.reset(new SkRTreeFactory); break;
172 case kTileGrid: factory.reset(new SkTileGridFactory(info)); break;
173 } 170 }
174 171
175 SkPictureRecorder recorder; 172 SkPictureRecorder recorder;
176 SkCanvas* canvas = recorder.beginRecording(1024, 1024, factory); 173 SkCanvas* canvas = recorder.beginRecording(1024, 1024, factory);
177 SkRandom rand; 174 SkRandom rand;
178 for (int i = 0; i < 10000; i++) { 175 for (int i = 0; i < 10000; i++) {
179 SkScalar x = rand.nextRangeScalar(0, 1024), 176 SkScalar x = rand.nextRangeScalar(0, 1024),
180 y = rand.nextRangeScalar(0, 1024), 177 y = rand.nextRangeScalar(0, 1024),
181 w = rand.nextRangeScalar(0, 128), 178 w = rand.nextRangeScalar(0, 128),
182 h = rand.nextRangeScalar(0, 128); 179 h = rand.nextRangeScalar(0, 128);
(...skipping 30 matching lines...) Expand all
213 BBH fBBH; 210 BBH fBBH;
214 Mode fMode; 211 Mode fMode;
215 SkString fName; 212 SkString fName;
216 SkAutoTUnref<SkPicture> fPic; 213 SkAutoTUnref<SkPicture> fPic;
217 }; 214 };
218 215
219 DEF_BENCH( return new TiledPlaybackBench(kNone, kRandom); ) 216 DEF_BENCH( return new TiledPlaybackBench(kNone, kRandom); )
220 DEF_BENCH( return new TiledPlaybackBench(kNone, kTiled ); ) 217 DEF_BENCH( return new TiledPlaybackBench(kNone, kTiled ); )
221 DEF_BENCH( return new TiledPlaybackBench(kRTree, kRandom); ) 218 DEF_BENCH( return new TiledPlaybackBench(kRTree, kRandom); )
222 DEF_BENCH( return new TiledPlaybackBench(kRTree, kTiled ); ) 219 DEF_BENCH( return new TiledPlaybackBench(kRTree, kTiled ); )
223 DEF_BENCH( return new TiledPlaybackBench(kTileGrid, kRandom); )
224 DEF_BENCH( return new TiledPlaybackBench(kTileGrid, kTiled ); )
OLDNEW
« no previous file with comments | « no previous file | dm/DMCpuGMTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698