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

Side by Side Diff: bench/RegionContainBench.cpp

Issue 73643005: Implement a benchmark for GrResourceCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address comments Created 7 years, 1 month 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/RegionBench.cpp ('k') | bench/ScalarBench.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 2013 Google Inc. 2 * Copyright 2013 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 "SkRandom.h" 9 #include "SkRandom.h"
10 #include "SkRegion.h" 10 #include "SkRegion.h"
(...skipping 25 matching lines...) Expand all
36 RegionContainBench(Proc proc, const char name[]) { 36 RegionContainBench(Proc proc, const char name[]) {
37 fProc = proc; 37 fProc = proc;
38 fName.printf("region_contains_%s", name); 38 fName.printf("region_contains_%s", name);
39 39
40 SkRandom rand; 40 SkRandom rand;
41 for (int i = 0; i < COUNT; i++) { 41 for (int i = 0; i < COUNT; i++) {
42 fA.op(randrect(rand, i), SkRegion::kXOR_Op); 42 fA.op(randrect(rand, i), SkRegion::kXOR_Op);
43 } 43 }
44 44
45 fB.setRect(0, 0, H, W); 45 fB.setRect(0, 0, H, W);
46 }
46 47
47 fIsRendering = false; 48 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
49 return backend == kNonRendering_Backend;
48 } 50 }
49 51
50 protected: 52 protected:
51 virtual const char* onGetName() { return fName.c_str(); } 53 virtual const char* onGetName() { return fName.c_str(); }
52 54
53 virtual void onDraw(SkCanvas*) { 55 virtual void onDraw(SkCanvas*) {
54 Proc proc = fProc; 56 Proc proc = fProc;
55 57
56 for (int i = 0; i < this->getLoops(); ++i) { 58 for (int i = 0; i < this->getLoops(); ++i) {
57 proc(fA, fB); 59 proc(fA, fB);
58 } 60 }
59 } 61 }
60 62
61 private: 63 private:
62 typedef SkBenchmark INHERITED; 64 typedef SkBenchmark INHERITED;
63 }; 65 };
64 66
65 DEF_BENCH( return SkNEW_ARGS(RegionContainBench, (sect_proc, "sect")); ) 67 DEF_BENCH( return SkNEW_ARGS(RegionContainBench, (sect_proc, "sect")); )
OLDNEW
« no previous file with comments | « bench/RegionBench.cpp ('k') | bench/ScalarBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698