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

Side by Side Diff: bench/RectBench.cpp

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 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/Xfer4fBench.cpp » ('j') | include/effects/SkXfermodeImageFilter.h » ('J')
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::Create(SkXfermode::kSrc_Mode); 88 fMode = SkXfermode::Make(SkXfermode::kSrc_Mode);
89 }
90
91 virtual ~SrcModeRectBench() {
92 SkSafeUnref(fMode);
93 } 89 }
94 90
95 protected: 91 protected:
96 void setupPaint(SkPaint* paint) override { 92 void setupPaint(SkPaint* paint) override {
97 this->INHERITED::setupPaint(paint); 93 this->INHERITED::setupPaint(paint);
98 // srcmode is most interesting when we're not opaque 94 // srcmode is most interesting when we're not opaque
99 paint->setAlpha(0x80); 95 paint->setAlpha(0x80);
100 paint->setXfermode(fMode); 96 paint->setXfermode(fMode);
101 } 97 }
102 98
103 const char* onGetName() override { 99 const char* onGetName() override {
104 fName.set(this->INHERITED::onGetName()); 100 fName.set(this->INHERITED::onGetName());
105 fName.prepend("srcmode_"); 101 fName.prepend("srcmode_");
106 return fName.c_str(); 102 return fName.c_str();
107 } 103 }
108 104
109 private: 105 private:
110 SkString fName; 106 SkString fName;
111 SkXfermode* fMode; 107 sk_sp<SkXfermode> fMode;
112 108
113 typedef RectBench INHERITED; 109 typedef RectBench INHERITED;
114 }; 110 };
115 111
116 class TransparentRectBench : public RectBench { 112 class TransparentRectBench : public RectBench {
117 public: 113 public:
118 TransparentRectBench() : INHERITED(1, 0) {} 114 TransparentRectBench() : INHERITED(1, 0) {}
119 115
120 protected: 116 protected:
121 void setupPaint(SkPaint* paint) override { 117 void setupPaint(SkPaint* paint) override {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 "maskopaque");) 295 "maskopaque");)
300 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 296 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
301 BlitMaskBench::kMaskBlack, 297 BlitMaskBench::kMaskBlack,
302 "maskblack");) 298 "maskblack");)
303 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 299 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
304 BlitMaskBench::kMaskColor, 300 BlitMaskBench::kMaskColor,
305 "maskcolor");) 301 "maskcolor");)
306 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 302 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
307 BlitMaskBench::KMaskShader, 303 BlitMaskBench::KMaskShader,
308 "maskshader");) 304 "maskshader");)
OLDNEW
« no previous file with comments | « no previous file | bench/Xfer4fBench.cpp » ('j') | include/effects/SkXfermodeImageFilter.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698