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

Side by Side Diff: bench/PatchGridBench.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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 | « bench/PatchBench.cpp ('k') | bench/PathBench.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 2014 Google Inc. 2 * Copyright 2014 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 7
8 #include "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 SK_ColorMAGENTA, SK_ColorBLUE, SK_ColorYELLOW, 156 SK_ColorMAGENTA, SK_ColorBLUE, SK_ColorYELLOW,
157 }; 157 };
158 const SkPoint pts[] = { { 200.f / 4.f, 0.f }, { 3.f * 200.f / 4, 200.f } }; 158 const SkPoint pts[] = { { 200.f / 4.f, 0.f }, { 3.f * 200.f / 4, 200.f } };
159 159
160 return SkGradientShader::CreateLinear(pts, colors, NULL, 160 return SkGradientShader::CreateLinear(pts, colors, NULL,
161 SK_ARRAY_COUNT(colors), 161 SK_ARRAY_COUNT(colors),
162 SkShader::kMirror_TileMode); 162 SkShader::kMirror_TileMode);
163 } 163 }
164 164
165 protected: 165 protected:
166 const char* onGetName() SK_OVERRIDE { 166 const char* onGetName() override {
167 SkString vertexMode; 167 SkString vertexMode;
168 switch (fVertexMode) { 168 switch (fVertexMode) {
169 case kNone_VertexMode: 169 case kNone_VertexMode:
170 vertexMode.set("meshlines"); 170 vertexMode.set("meshlines");
171 break; 171 break;
172 case kColors_VertexMode: 172 case kColors_VertexMode:
173 vertexMode.set("colors"); 173 vertexMode.set("colors");
174 break; 174 break;
175 case kTexCoords_VertexMode: 175 case kTexCoords_VertexMode:
176 vertexMode.set("texs"); 176 vertexMode.set("texs");
(...skipping 16 matching lines...) Expand all
193 case kBig_Size: 193 case kBig_Size:
194 size.set("big"); 194 size.set("big");
195 break; 195 break;
196 default: 196 default:
197 break; 197 break;
198 } 198 }
199 fName.printf("patch_grid_%s_%s", vertexMode.c_str(), size.c_str()); 199 fName.printf("patch_grid_%s_%s", vertexMode.c_str(), size.c_str());
200 return fName.c_str(); 200 return fName.c_str();
201 } 201 }
202 202
203 void onPreDraw() SK_OVERRIDE { 203 void onPreDraw() override {
204 this->setGrid(); 204 this->setGrid();
205 switch (fVertexMode) { 205 switch (fVertexMode) {
206 case kTexCoords_VertexMode: 206 case kTexCoords_VertexMode:
207 case kBoth_VertexMode: 207 case kBoth_VertexMode:
208 fPaint.setShader(createShader())->unref(); 208 fPaint.setShader(createShader())->unref();
209 break; 209 break;
210 default: 210 default:
211 fPaint.setShader(NULL); 211 fPaint.setShader(NULL);
212 break; 212 break;
213 } 213 }
214 this->setupPaint(&fPaint); 214 this->setupPaint(&fPaint);
215 } 215 }
216 216
217 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { 217 void onDraw(const int loops, SkCanvas* canvas) override {
218 this->setScale(canvas); 218 this->setScale(canvas);
219 for (int i = 0; i < loops; i++) { 219 for (int i = 0; i < loops; i++) {
220 fGrid.draw(canvas, fPaint); 220 fGrid.draw(canvas, fPaint);
221 } 221 }
222 } 222 }
223 223
224 SkPaint fPaint; 224 SkPaint fPaint;
225 SkString fName; 225 SkString fName;
226 SkPatchGrid fGrid; 226 SkPatchGrid fGrid;
227 VertexMode fVertexMode; 227 VertexMode fVertexMode;
(...skipping 22 matching lines...) Expand all
250 DEF_BENCH( return new PatchGridBench(PatchGridBench::kMedium_Size, 250 DEF_BENCH( return new PatchGridBench(PatchGridBench::kMedium_Size,
251 PatchGridBench::kBoth_VertexMode); ) 251 PatchGridBench::kBoth_VertexMode); )
252 DEF_BENCH( return new PatchGridBench(PatchGridBench::kBig_Size, 252 DEF_BENCH( return new PatchGridBench(PatchGridBench::kBig_Size,
253 PatchGridBench::kNone_VertexMode); ) 253 PatchGridBench::kNone_VertexMode); )
254 DEF_BENCH( return new PatchGridBench(PatchGridBench::kBig_Size, 254 DEF_BENCH( return new PatchGridBench(PatchGridBench::kBig_Size,
255 PatchGridBench::kColors_VertexMode); ) 255 PatchGridBench::kColors_VertexMode); )
256 DEF_BENCH( return new PatchGridBench(PatchGridBench::kBig_Size, 256 DEF_BENCH( return new PatchGridBench(PatchGridBench::kBig_Size,
257 PatchGridBench::kTexCoords_VertexMode); ) 257 PatchGridBench::kTexCoords_VertexMode); )
258 DEF_BENCH( return new PatchGridBench(PatchGridBench::kBig_Size, 258 DEF_BENCH( return new PatchGridBench(PatchGridBench::kBig_Size,
259 PatchGridBench::kBoth_VertexMode); ) 259 PatchGridBench::kBoth_VertexMode); )
OLDNEW
« no previous file with comments | « bench/PatchBench.cpp ('k') | bench/PathBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698