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

Side by Side Diff: bench/AlternatingColorPatternBench.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 | bench/BitmapBench.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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 fPattern1.fName, fPattern2.fName, 101 fPattern1.fName, fPattern2.fName,
102 kRect_DrawType == drawType ? "rect" : "path"); 102 kRect_DrawType == drawType ? "rect" : "path");
103 fDrawType = drawType; 103 fDrawType = drawType;
104 } 104 }
105 105
106 virtual ~AlternatingColorPatternBench() { 106 virtual ~AlternatingColorPatternBench() {
107 SkSafeUnref(fBmShader); 107 SkSafeUnref(fBmShader);
108 } 108 }
109 109
110 protected: 110 protected:
111 virtual const char* onGetName() SK_OVERRIDE { 111 const char* onGetName() SK_OVERRIDE {
112 return fName.c_str(); 112 return fName.c_str();
113 } 113 }
114 114
115 virtual void onPreDraw() { 115 virtual void onPreDraw() {
116 int w = 40; 116 int w = 40;
117 int h = 40; 117 int h = 40;
118 makebm(&fBmp, w, h); 118 makebm(&fBmp, w, h);
119 fBmShader = SkShader::CreateBitmapShader(fBmp, 119 fBmShader = SkShader::CreateBitmapShader(fBmp,
120 SkShader::kRepeat_TileMode, 120 SkShader::kRepeat_TileMode,
121 SkShader::kRepeat_TileMode); 121 SkShader::kRepeat_TileMode);
(...skipping 17 matching lines...) Expand all
139 fShaders[count] = fPattern1.fIsBitmap ? fBmShader : NULL; 139 fShaders[count] = fPattern1.fIsBitmap ? fBmShader : NULL;
140 } else { 140 } else {
141 fColors[count] = fPattern2.fColor; 141 fColors[count] = fPattern2.fColor;
142 fShaders[count] = fPattern2.fIsBitmap ? fBmShader : NULL; 142 fShaders[count] = fPattern2.fIsBitmap ? fBmShader : NULL;
143 } 143 }
144 ++count; 144 ++count;
145 } 145 }
146 } 146 }
147 } 147 }
148 148
149 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { 149 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
150 SkPaint paint; 150 SkPaint paint;
151 paint.setAntiAlias(false); 151 paint.setAntiAlias(false);
152 paint.setFilterLevel(SkPaint::kLow_FilterLevel); 152 paint.setFilterLevel(SkPaint::kLow_FilterLevel);
153 153
154 for (int i = 0; i < loops; ++i) { 154 for (int i = 0; i < loops; ++i) {
155 for (int j = 0; j < NUM_DRAWS; ++j) { 155 for (int j = 0; j < NUM_DRAWS; ++j) {
156 paint.setColor(fColors[j]); 156 paint.setColor(fColors[j]);
157 paint.setShader(fShaders[j]); 157 paint.setShader(fShaders[j]);
158 if (kRect_DrawType == fDrawType) { 158 if (kRect_DrawType == fDrawType) {
159 canvas->drawRect(fRects[j], paint); 159 canvas->drawRect(fRects[j], paint);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench, 191 DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench,
192 (kOpaqueBitmap_ColorPattern, kOpaqueBitmap_ColorPat tern, 192 (kOpaqueBitmap_ColorPattern, kOpaqueBitmap_ColorPat tern,
193 kRect_DrawType)); ) 193 kRect_DrawType)); )
194 DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench, 194 DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench,
195 (kAlphaBitmap_ColorPattern, kAlphaBitmap_ColorPatte rn, 195 (kAlphaBitmap_ColorPattern, kAlphaBitmap_ColorPatte rn,
196 kRect_DrawType)); ) 196 kRect_DrawType)); )
197 DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench, 197 DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench,
198 (kOpaqueBitmap_ColorPattern, kAlphaBitmap_ColorPatt ern, 198 (kOpaqueBitmap_ColorPattern, kAlphaBitmap_ColorPatt ern,
199 kRect_DrawType)); ) 199 kRect_DrawType)); )
200 200
OLDNEW
« no previous file with comments | « no previous file | bench/BitmapBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698