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

Side by Side Diff: bench/RectBench.cpp

Issue 23432008: Add explicit double -> SkScalar conversion to fix werror on Windows. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: reupload Created 7 years, 3 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 | no next file » | 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCommandLineFlags.h" 10 #include "SkCommandLineFlags.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 protected: 143 protected:
144 virtual void onDraw(SkCanvas* canvas) { 144 virtual void onDraw(SkCanvas* canvas) {
145 SkScalar gSizes[] = { 145 SkScalar gSizes[] = {
146 SkIntToScalar(7), 0 146 SkIntToScalar(7), 0
147 }; 147 };
148 size_t sizes = SK_ARRAY_COUNT(gSizes); 148 size_t sizes = SK_ARRAY_COUNT(gSizes);
149 149
150 if (FLAGS_strokeWidth >= 0) { 150 if (FLAGS_strokeWidth >= 0) {
151 gSizes[0] = FLAGS_strokeWidth; 151 gSizes[0] = (SkScalar)FLAGS_strokeWidth;
152 sizes = 1; 152 sizes = 1;
153 } 153 }
154 154
155 SkPaint paint; 155 SkPaint paint;
156 paint.setStrokeCap(SkPaint::kRound_Cap); 156 paint.setStrokeCap(SkPaint::kRound_Cap);
157 157
158 for (int loop = 0; loop < this->getLoops(); loop++) { 158 for (int loop = 0; loop < this->getLoops(); loop++) {
159 for (size_t i = 0; i < sizes; i++) { 159 for (size_t i = 0; i < sizes; i++) {
160 paint.setStrokeWidth(gSizes[i]); 160 paint.setStrokeWidth(gSizes[i]);
161 this->setupPaint(&paint); 161 this->setupPaint(&paint);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 243 }
244 244
245 protected: 245 protected:
246 virtual void onDraw(SkCanvas* canvas) { 246 virtual void onDraw(SkCanvas* canvas) {
247 SkScalar gSizes[] = { 247 SkScalar gSizes[] = {
248 SkIntToScalar(13), SkIntToScalar(24) 248 SkIntToScalar(13), SkIntToScalar(24)
249 }; 249 };
250 size_t sizes = SK_ARRAY_COUNT(gSizes); 250 size_t sizes = SK_ARRAY_COUNT(gSizes);
251 251
252 if (FLAGS_strokeWidth >= 0) { 252 if (FLAGS_strokeWidth >= 0) {
253 gSizes[0] = FLAGS_strokeWidth; 253 gSizes[0] = (SkScalar)FLAGS_strokeWidth;
254 sizes = 1; 254 sizes = 1;
255 } 255 }
256 SkRandom rand; 256 SkRandom rand;
257 SkColor color = 0xFF000000; 257 SkColor color = 0xFF000000;
258 U8CPU alpha = 0xFF; 258 U8CPU alpha = 0xFF;
259 SkPaint paint; 259 SkPaint paint;
260 paint.setStrokeCap(SkPaint::kRound_Cap); 260 paint.setStrokeCap(SkPaint::kRound_Cap);
261 if (_type == KMaskShader) { 261 if (_type == KMaskShader) {
262 SkBitmap srcBM; 262 SkBitmap srcBM;
263 srcBM.setConfig(SkBitmap::kARGB_8888_Config, 10, 1); 263 srcBM.setConfig(SkBitmap::kARGB_8888_Config, 10, 1);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 BlitMaskBench::kMaskBlack, "maskblack") 334 BlitMaskBench::kMaskBlack, "maskblack")
335 ); ) 335 ); )
336 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench, 336 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
337 (p, SkCanvas::kPoints_PointMode, 337 (p, SkCanvas::kPoints_PointMode,
338 BlitMaskBench::kMaskColor, "maskcolor") 338 BlitMaskBench::kMaskColor, "maskcolor")
339 ); ) 339 ); )
340 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench, 340 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
341 (p, SkCanvas::kPoints_PointMode, 341 (p, SkCanvas::kPoints_PointMode,
342 BlitMaskBench::KMaskShader, "maskshader") 342 BlitMaskBench::KMaskShader, "maskshader")
343 ); ) 343 ); )
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698