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

Side by Side Diff: bench/WriterBench.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/WritePixelsBench.cpp ('k') | bench/XfermodeBench.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 2012 The Android Open Source Project 3 * Copyright 2012 The Android Open Source Project
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"
11 #include "SkWriter32.h" 11 #include "SkWriter32.h"
12 12
13 class WriterBench : public SkBenchmark { 13 class WriterBench : public SkBenchmark {
14 public: 14 public:
15 WriterBench(void* param) : INHERITED(param) { 15 WriterBench() { fIsRendering = false; }
16 fIsRendering = false;
17 }
18 16
19 protected: 17 protected:
20 virtual const char* onGetName() SK_OVERRIDE { 18 virtual const char* onGetName() SK_OVERRIDE {
21 return "writer"; 19 return "writer";
22 } 20 }
23 21
24 virtual void onDraw(SkCanvas*) SK_OVERRIDE { 22 virtual void onDraw(SkCanvas*) SK_OVERRIDE {
25 static const char gStr[] = "abcdefghimjklmnopqrstuvwxyz"; 23 static const char gStr[] = "abcdefghimjklmnopqrstuvwxyz";
26 static const size_t gLen = strlen(gStr); 24 static const size_t gLen = strlen(gStr);
27 SkWriter32 writer(256 * 4); 25 SkWriter32 writer(256 * 4);
28 for (int i = 0; i < this->getLoops(); i++) { 26 for (int i = 0; i < this->getLoops(); i++) {
29 for (size_t j = 0; j <= gLen; j++) { 27 for (size_t j = 0; j <= gLen; j++) {
30 writer.writeString(gStr, j); 28 writer.writeString(gStr, j);
31 } 29 }
32 } 30 }
33 } 31 }
34 32
35 private: 33 private:
36 typedef SkBenchmark INHERITED; 34 typedef SkBenchmark INHERITED;
37 }; 35 };
38 36
39 //////////////////////////////////////////////////////////////////////////////// 37 ////////////////////////////////////////////////////////////////////////////////
40 38
41 static SkBenchmark* fact(void* p) { return new WriterBench(p); } 39 DEF_BENCH( return new WriterBench(); )
42 static BenchRegistry gReg(fact);
OLDNEW
« no previous file with comments | « bench/WritePixelsBench.cpp ('k') | bench/XfermodeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698