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

Side by Side Diff: bench/RectBench.cpp

Issue 2396953002: Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints" (Closed)
Patch Set: add tmp virtual to unroll legacy arithmodes Created 4 years, 2 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 | bench/RotatedRectBench.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 #include "Benchmark.h" 7 #include "Benchmark.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCommandLineFlags.h" 9 #include "SkCommandLineFlags.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 this->drawThisRect(canvas, fRects[i % N], paint); 78 this->drawThisRect(canvas, fRects[i % N], paint);
79 } 79 }
80 } 80 }
81 private: 81 private:
82 typedef Benchmark INHERITED; 82 typedef Benchmark INHERITED;
83 }; 83 };
84 84
85 class SrcModeRectBench : public RectBench { 85 class SrcModeRectBench : public RectBench {
86 public: 86 public:
87 SrcModeRectBench() : INHERITED(1, 0) { 87 SrcModeRectBench() : INHERITED(1, 0) {
88 fMode = SkXfermode::Make(SkXfermode::kSrc_Mode); 88 fMode = SkBlendMode::kSrc;
89 } 89 }
90 90
91 protected: 91 protected:
92 void setupPaint(SkPaint* paint) override { 92 void setupPaint(SkPaint* paint) override {
93 this->INHERITED::setupPaint(paint); 93 this->INHERITED::setupPaint(paint);
94 // srcmode is most interesting when we're not opaque 94 // srcmode is most interesting when we're not opaque
95 paint->setAlpha(0x80); 95 paint->setAlpha(0x80);
96 paint->setXfermode(fMode); 96 paint->setBlendMode(fMode);
97 } 97 }
98 98
99 const char* onGetName() override { 99 const char* onGetName() override {
100 fName.set(this->INHERITED::onGetName()); 100 fName.set(this->INHERITED::onGetName());
101 fName.prepend("srcmode_"); 101 fName.prepend("srcmode_");
102 return fName.c_str(); 102 return fName.c_str();
103 } 103 }
104 104
105 private: 105 private:
106 SkString fName; 106 SkString fName;
107 sk_sp<SkXfermode> fMode; 107 SkBlendMode fMode;
108 108
109 typedef RectBench INHERITED; 109 typedef RectBench INHERITED;
110 }; 110 };
111 111
112 class TransparentRectBench : public RectBench { 112 class TransparentRectBench : public RectBench {
113 public: 113 public:
114 TransparentRectBench() : INHERITED(1, 0) {} 114 TransparentRectBench() : INHERITED(1, 0) {}
115 115
116 protected: 116 protected:
117 void setupPaint(SkPaint* paint) override { 117 void setupPaint(SkPaint* paint) override {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 "maskopaque");) 295 "maskopaque");)
296 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 296 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
297 BlitMaskBench::kMaskBlack, 297 BlitMaskBench::kMaskBlack,
298 "maskblack");) 298 "maskblack");)
299 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 299 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
300 BlitMaskBench::kMaskColor, 300 BlitMaskBench::kMaskColor,
301 "maskcolor");) 301 "maskcolor");)
302 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 302 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
303 BlitMaskBench::KMaskShader, 303 BlitMaskBench::KMaskShader,
304 "maskshader");) 304 "maskshader");)
OLDNEW
« no previous file with comments | « no previous file | bench/RotatedRectBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698