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

Side by Side Diff: bench/VertBench.cpp

Issue 23876006: Refactoring: get rid of the SkBenchmark void* parameter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: sync to head 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/TileBench.cpp ('k') | bench/WritePixelsBench.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 2011 Google Inc. 2 * Copyright 2011 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 "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 21 matching lines...) Expand all
32 SkColor fColors[PTS]; 32 SkColor fColors[PTS];
33 uint16_t fIdx[IDX]; 33 uint16_t fIdx[IDX];
34 34
35 static void load_2_tris(uint16_t idx[], int x, int y, int rb) { 35 static void load_2_tris(uint16_t idx[], int x, int y, int rb) {
36 int n = y * rb + x; 36 int n = y * rb + x;
37 idx[0] = n; idx[1] = n + 1; idx[2] = rb + n + 1; 37 idx[0] = n; idx[1] = n + 1; idx[2] = rb + n + 1;
38 idx[3] = n; idx[4] = rb + n + 1; idx[5] = n + rb; 38 idx[3] = n; idx[4] = rb + n + 1; idx[5] = n + rb;
39 } 39 }
40 40
41 public: 41 public:
42 VertBench(void* param) : INHERITED(param) { 42 VertBench() {
43 const SkScalar dx = SkIntToScalar(W) / COL; 43 const SkScalar dx = SkIntToScalar(W) / COL;
44 const SkScalar dy = SkIntToScalar(H) / COL; 44 const SkScalar dy = SkIntToScalar(H) / COL;
45 45
46 SkPoint* pts = fPts; 46 SkPoint* pts = fPts;
47 uint16_t* idx = fIdx; 47 uint16_t* idx = fIdx;
48 48
49 SkScalar yy = 0; 49 SkScalar yy = 0;
50 for (int y = 0; y <= ROW; y++) { 50 for (int y = 0; y <= ROW; y++) {
51 SkScalar xx = 0; 51 SkScalar xx = 0;
52 for (int x = 0; x <= COL; ++x) { 52 for (int x = 0; x <= COL; ++x) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, PTS, 85 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, PTS,
86 fPts, NULL, fColors, NULL, fIdx, IDX, paint); 86 fPts, NULL, fColors, NULL, fIdx, IDX, paint);
87 } 87 }
88 } 88 }
89 private: 89 private:
90 typedef SkBenchmark INHERITED; 90 typedef SkBenchmark INHERITED;
91 }; 91 };
92 92
93 /////////////////////////////////////////////////////////////////////////////// 93 ///////////////////////////////////////////////////////////////////////////////
94 94
95 static SkBenchmark* Fact(void* p) { return SkNEW_ARGS(VertBench, (p)); } 95 DEF_BENCH( return SkNEW_ARGS(VertBench, ()); )
96
97 static BenchRegistry gReg(Fact);
OLDNEW
« no previous file with comments | « bench/TileBench.cpp ('k') | bench/WritePixelsBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698