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

Side by Side Diff: bench/RectBench.cpp

Issue 1363663004: stop scaling loops and improve warmup bench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: transparent Created 5 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
« no previous file with comments | « no previous file | tools/VisualBench/VisualLightweightBenchModule.h » ('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 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 "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCommandLineFlags.h" 10 #include "SkCommandLineFlags.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return fName.c_str(); 107 return fName.c_str();
108 } 108 }
109 109
110 private: 110 private:
111 SkString fName; 111 SkString fName;
112 SkXfermode* fMode; 112 SkXfermode* fMode;
113 113
114 typedef RectBench INHERITED; 114 typedef RectBench INHERITED;
115 }; 115 };
116 116
117 class TransparentRectBench : public RectBench {
118 public:
119 TransparentRectBench() : INHERITED(1, 0) {}
120
121 protected:
122 void setupPaint(SkPaint* paint) override {
123 this->INHERITED::setupPaint(paint);
124 // draw non opaque rect
125 paint->setAlpha(0x80);
126 }
127
128 const char* onGetName() override {
129 fName.set(this->INHERITED::onGetName());
130 fName.prepend("transparent_");
131 return fName.c_str();
132 }
133
134 private:
135 SkString fName;
136
137 typedef RectBench INHERITED;
138 };
139
140
117 class OvalBench : public RectBench { 141 class OvalBench : public RectBench {
118 public: 142 public:
119 OvalBench(int shift, int stroke = 0) : RectBench(shift, stroke) {} 143 OvalBench(int shift, int stroke = 0) : RectBench(shift, stroke) {}
120 protected: 144 protected:
121 virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) { 145 virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) {
122 c->drawOval(r, p); 146 c->drawOval(r, p);
123 } 147 }
124 virtual const char* onGetName() { return computeName("ovals"); } 148 virtual const char* onGetName() { return computeName("ovals"); }
125 }; 149 };
126 150
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 DEF_BENCH(return new RRectBench(1);) 286 DEF_BENCH(return new RRectBench(1);)
263 DEF_BENCH(return new RRectBench(1, 4);) 287 DEF_BENCH(return new RRectBench(1, 4);)
264 DEF_BENCH(return new RRectBench(3);) 288 DEF_BENCH(return new RRectBench(3);)
265 DEF_BENCH(return new RRectBench(3, 4);) 289 DEF_BENCH(return new RRectBench(3, 4);)
266 DEF_BENCH(return new PointsBench(SkCanvas::kPoints_PointMode, "points");) 290 DEF_BENCH(return new PointsBench(SkCanvas::kPoints_PointMode, "points");)
267 DEF_BENCH(return new PointsBench(SkCanvas::kLines_PointMode, "lines");) 291 DEF_BENCH(return new PointsBench(SkCanvas::kLines_PointMode, "lines");)
268 DEF_BENCH(return new PointsBench(SkCanvas::kPolygon_PointMode, "polygon");) 292 DEF_BENCH(return new PointsBench(SkCanvas::kPolygon_PointMode, "polygon");)
269 293
270 DEF_BENCH(return new SrcModeRectBench();) 294 DEF_BENCH(return new SrcModeRectBench();)
271 295
296 DEF_BENCH(return new TransparentRectBench();)
297
272 /* init the blitmask bench 298 /* init the blitmask bench
273 */ 299 */
274 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 300 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
275 BlitMaskBench::kMaskOpaque, 301 BlitMaskBench::kMaskOpaque,
276 "maskopaque");) 302 "maskopaque");)
277 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 303 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
278 BlitMaskBench::kMaskBlack, 304 BlitMaskBench::kMaskBlack,
279 "maskblack");) 305 "maskblack");)
280 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 306 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
281 BlitMaskBench::kMaskColor, 307 BlitMaskBench::kMaskColor,
282 "maskcolor");) 308 "maskcolor");)
283 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 309 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
284 BlitMaskBench::KMaskShader, 310 BlitMaskBench::KMaskShader,
285 "maskshader");) 311 "maskshader");)
OLDNEW
« no previous file with comments | « no previous file | tools/VisualBench/VisualLightweightBenchModule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698