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

Side by Side Diff: bench/BitmapBench.cpp

Issue 18942002: fix compile warnings (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: virtual destructor Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | bench/BitmapScaleBench.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 SkPaint paint(fPaint); 142 SkPaint paint(fPaint);
143 this->setupPaint(&paint); 143 this->setupPaint(&paint);
144 144
145 const SkBitmap& bitmap = fBitmap; 145 const SkBitmap& bitmap = fBitmap;
146 const SkScalar x0 = SkIntToScalar(-bitmap.width() / 2); 146 const SkScalar x0 = SkIntToScalar(-bitmap.width() / 2);
147 const SkScalar y0 = SkIntToScalar(-bitmap.height() / 2); 147 const SkScalar y0 = SkIntToScalar(-bitmap.height() / 2);
148 148
149 int count = N; 149 int count = N;
150 #ifdef SK_RELEASE 150 #ifdef SK_RELEASE
151 // in DEBUG, N is always 1 151 // in DEBUG, N is always 1
152 if (paint.getFlags() & SkPaint::kBicubicFilterBitmap_Flag) { 152 if (paint.getFlags() & SkPaint::kHighQualityFilterBitmap_Flag) {
153 count /= BICUBIC_DUR_SCALE; 153 count /= BICUBIC_DUR_SCALE;
154 } 154 }
155 #endif 155 #endif
156 for (int i = 0; i < count; i++) { 156 for (int i = 0; i < count; i++) {
157 SkScalar x = x0 + rand.nextUScalar1() * dim.fX; 157 SkScalar x = x0 + rand.nextUScalar1() * dim.fX;
158 SkScalar y = y0 + rand.nextUScalar1() * dim.fY; 158 SkScalar y = y0 + rand.nextUScalar1() * dim.fY;
159 159
160 if (fForceUpdate) 160 if (fForceUpdate)
161 bitmap.notifyPixelsChanged(); 161 bitmap.notifyPixelsChanged();
162 162
163 canvas->drawBitmap(bitmap, x, y, &paint); 163 canvas->drawBitmap(bitmap, x, y, &paint);
164 } 164 }
165 } 165 }
166 166
167 virtual float onGetDurationScale() SK_OVERRIDE { 167 virtual float onGetDurationScale() SK_OVERRIDE {
168 SkPaint paint; 168 SkPaint paint;
169 this->setupPaint(&paint); 169 this->setupPaint(&paint);
170 #ifdef SK_DEBUG 170 #ifdef SK_DEBUG
171 return 1; 171 return 1;
172 #else 172 #else
173 return (paint.getFlags() & SkPaint::kBicubicFilterBitmap_Flag) ? 173 return (paint.getFlags() & SkPaint::kHighQualityFilterBitmap_Flag) ?
174 (float)BICUBIC_DUR_SCALE : 1; 174 (float)BICUBIC_DUR_SCALE : 1;
175 #endif 175 #endif
176 } 176 }
177 177
178 virtual void onDrawIntoBitmap(const SkBitmap& bm) { 178 virtual void onDrawIntoBitmap(const SkBitmap& bm) {
179 const int w = bm.width(); 179 const int w = bm.width();
180 const int h = bm.height(); 180 const int h = bm.height();
181 181
182 SkCanvas canvas(bm); 182 SkCanvas canvas(bm);
183 SkPaint p; 183 SkPaint p;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 if (fFlags & kRotate_Flag) { 259 if (fFlags & kRotate_Flag) {
260 const SkScalar x = SkIntToScalar(dim.fWidth) / 2; 260 const SkScalar x = SkIntToScalar(dim.fWidth) / 2;
261 const SkScalar y = SkIntToScalar(dim.fHeight) / 2; 261 const SkScalar y = SkIntToScalar(dim.fHeight) / 2;
262 262
263 canvas->translate(x, y); 263 canvas->translate(x, y);
264 canvas->rotate(SkIntToScalar(35)); 264 canvas->rotate(SkIntToScalar(35));
265 canvas->translate(-x, -y); 265 canvas->translate(-x, -y);
266 } 266 }
267 267
268 uint32_t orMask = 0; 268 uint32_t orMask = 0;
269 uint32_t clearMask = SkPaint::kFilterBitmap_Flag | SkPaint::kBicubicFilt erBitmap_Flag; 269 uint32_t clearMask = SkPaint::kFilterBitmap_Flag | SkPaint::kHighQuality FilterBitmap_Flag;
270 if (fFlags & kBilerp_Flag) { 270 if (fFlags & kBilerp_Flag) {
271 orMask |= SkPaint::kFilterBitmap_Flag; 271 orMask |= SkPaint::kFilterBitmap_Flag;
272 } 272 }
273 if (fFlags & kBicubic_Flag) { 273 if (fFlags & kBicubic_Flag) {
274 orMask |= SkPaint::kBicubicFilterBitmap_Flag; 274 orMask |= SkPaint::kHighQualityFilterBitmap_Flag;
275 } 275 }
276 this->setPaintMasks(orMask, clearMask); 276 this->setPaintMasks(orMask, clearMask);
277 277
278 INHERITED::onDraw(canvas); 278 INHERITED::onDraw(canvas);
279 } 279 }
280 280
281 private: 281 private:
282 typedef BitmapBench INHERITED; 282 typedef BitmapBench INHERITED;
283 }; 283 };
284 284
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 DEF_BENCH( return new FilterBitmapBench(p, true, SkBitmap::kARGB_8888_Config, tr ue, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); ) 392 DEF_BENCH( return new FilterBitmapBench(p, true, SkBitmap::kARGB_8888_Config, tr ue, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); )
393 393
394 DEF_BENCH( return new FilterBitmapBench(p, false, SkBitmap::kARGB_8888_Config, f alse, false, kScale_Flag | kBilerp_Flag | kBicubic_Flag); ) 394 DEF_BENCH( return new FilterBitmapBench(p, false, SkBitmap::kARGB_8888_Config, f alse, false, kScale_Flag | kBilerp_Flag | kBicubic_Flag); )
395 DEF_BENCH( return new FilterBitmapBench(p, false, SkBitmap::kARGB_8888_Config, f alse, false, kScale_Flag | kRotate_Flag | kBilerp_Flag | kBicubic_Flag); ) 395 DEF_BENCH( return new FilterBitmapBench(p, false, SkBitmap::kARGB_8888_Config, f alse, false, kScale_Flag | kRotate_Flag | kBilerp_Flag | kBicubic_Flag); )
396 396
397 // source alpha tests -> S32A_Opaque_BlitRow32_{arm,neon} 397 // source alpha tests -> S32A_Opaque_BlitRow32_{arm,neon}
398 DEF_BENCH( return new SourceAlphaBitmapBench(p, SourceAlphaBitmapBench::kOpaque_ SourceAlpha, SkBitmap::kARGB_8888_Config); ) 398 DEF_BENCH( return new SourceAlphaBitmapBench(p, SourceAlphaBitmapBench::kOpaque_ SourceAlpha, SkBitmap::kARGB_8888_Config); )
399 DEF_BENCH( return new SourceAlphaBitmapBench(p, SourceAlphaBitmapBench::kTranspa rent_SourceAlpha, SkBitmap::kARGB_8888_Config); ) 399 DEF_BENCH( return new SourceAlphaBitmapBench(p, SourceAlphaBitmapBench::kTranspa rent_SourceAlpha, SkBitmap::kARGB_8888_Config); )
400 DEF_BENCH( return new SourceAlphaBitmapBench(p, SourceAlphaBitmapBench::kTwoStri pes_SourceAlpha, SkBitmap::kARGB_8888_Config); ) 400 DEF_BENCH( return new SourceAlphaBitmapBench(p, SourceAlphaBitmapBench::kTwoStri pes_SourceAlpha, SkBitmap::kARGB_8888_Config); )
401 DEF_BENCH( return new SourceAlphaBitmapBench(p, SourceAlphaBitmapBench::kThreeSt ripes_SourceAlpha, SkBitmap::kARGB_8888_Config); ) 401 DEF_BENCH( return new SourceAlphaBitmapBench(p, SourceAlphaBitmapBench::kThreeSt ripes_SourceAlpha, SkBitmap::kARGB_8888_Config); )
OLDNEW
« no previous file with comments | « no previous file | bench/BitmapScaleBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698