OLD | NEW |
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 Loading... |
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 Loading... |
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");) |
OLD | NEW |