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

Side by Side Diff: bench/FSRectBench.cpp

Issue 23478013: Major bench refactoring. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: merge with head agani 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 | « bench/DisplacementBench.cpp ('k') | bench/FontCacheBench.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 2013 Google Inc. 3 * Copyright 2013 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 8
9 #include "SkBenchmark.h" 9 #include "SkBenchmark.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 26 matching lines...) Expand all
37 fRects[i].fRight = W + kMinOffset + SkScalarMul(rand.nextUScalar 1(), kOffsetRange); 37 fRects[i].fRight = W + kMinOffset + SkScalarMul(rand.nextUScalar 1(), kOffsetRange);
38 fRects[i].fBottom = H + kMinOffset + SkScalarMul(rand.nextUScala r1(), kOffsetRange); 38 fRects[i].fBottom = H + kMinOffset + SkScalarMul(rand.nextUScala r1(), kOffsetRange);
39 fColors[i] = rand.nextU() | 0xFF000000; 39 fColors[i] = rand.nextU() | 0xFF000000;
40 } 40 }
41 fInit = true; 41 fInit = true;
42 } 42 }
43 } 43 }
44 44
45 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 45 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
46 SkPaint paint; 46 SkPaint paint;
47 for (int i = 0; i < N; ++i) { 47 for (int i = 0; i < this->getLoops(); ++i) {
48 paint.setColor(fColors[i]); 48 paint.setColor(fColors[i % N]);
49 canvas->drawRect(fRects[i], paint); 49 canvas->drawRect(fRects[i % N], paint);
50 } 50 }
51 } 51 }
52 52
53 private: 53 private:
54 enum { 54 enum {
55 W = 640, 55 W = 640,
56 H = 480, 56 H = 480,
57 N = SkBENCHLOOP(300) 57 N = 300,
58 }; 58 };
59 SkRect fRects[N]; 59 SkRect fRects[N];
60 SkColor fColors[N]; 60 SkColor fColors[N];
61 bool fInit; 61 bool fInit;
62 62
63 typedef SkBenchmark INHERITED; 63 typedef SkBenchmark INHERITED;
64 }; 64 };
65 65
66 DEF_BENCH( return SkNEW_ARGS(FSRectBench, (p)); ) 66 DEF_BENCH( return SkNEW_ARGS(FSRectBench, (p)); )
OLDNEW
« no previous file with comments | « bench/DisplacementBench.cpp ('k') | bench/FontCacheBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698