epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 7 | #include "Benchmark.h" |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 8 | #include "SkCanvas.h" |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 9 | #include "SkCommandLineFlags.h" |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 10 | #include "SkPaint.h" |
| 11 | #include "SkRandom.h" |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 12 | #include "SkShader.h" |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 13 | #include "SkString.h" |
| 14 | |
| 15 | DEFINE_double(strokeWidth, -1.0, "If set, use this stroke width in RectBench."); |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 16 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 17 | class RectBench : public Benchmark { |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 18 | public: |
mike@reedtribe.org | 2ecead5 | 2011-04-02 13:37:23 +0000 | [diff] [blame] | 19 | int fShift, fStroke; |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 20 | enum { |
| 21 | W = 640, |
| 22 | H = 480, |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 23 | N = 300, |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 24 | }; |
| 25 | SkRect fRects[N]; |
| 26 | SkColor fColors[N]; |
| 27 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 28 | RectBench(int shift, int stroke = 0) |
| 29 | : fShift(shift) |
commit-bot@chromium.org | 000d732 | 2013-12-05 12:07:44 +0000 | [diff] [blame] | 30 | , fStroke(stroke) {} |
reed@google.com | 1fcd51e | 2011-01-05 15:50:27 +0000 | [diff] [blame] | 31 | |
reed@android.com | d2c3744 | 2009-01-08 03:00:57 +0000 | [diff] [blame] | 32 | const char* computeName(const char root[]) { |
Brian Salomon | 3349c6f | 2017-03-01 09:49:58 -0500 | [diff] [blame] | 33 | fBaseName.printf("%s_%d", root, fShift); |
mike@reedtribe.org | 2ecead5 | 2011-04-02 13:37:23 +0000 | [diff] [blame] | 34 | if (fStroke > 0) { |
Brian Salomon | 3349c6f | 2017-03-01 09:49:58 -0500 | [diff] [blame] | 35 | fBaseName.appendf("_stroke_%d", fStroke); |
mike@reedtribe.org | 2ecead5 | 2011-04-02 13:37:23 +0000 | [diff] [blame] | 36 | } |
Brian Salomon | 3349c6f | 2017-03-01 09:49:58 -0500 | [diff] [blame] | 37 | return fBaseName.c_str(); |
reed@android.com | d2c3744 | 2009-01-08 03:00:57 +0000 | [diff] [blame] | 38 | } |
reed@google.com | 1fcd51e | 2011-01-05 15:50:27 +0000 | [diff] [blame] | 39 | |
joshualitt | 7d4b458 | 2015-09-24 08:08:23 -0700 | [diff] [blame] | 40 | bool isVisual() override { return true; } |
| 41 | |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 42 | protected: |
Brian Salomon | dac5f6b | 2017-02-28 16:11:04 -0500 | [diff] [blame] | 43 | |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 44 | virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) { |
| 45 | c->drawRect(r, p); |
| 46 | } |
| 47 | |
reed | 57b7671 | 2015-09-25 04:49:43 -0700 | [diff] [blame] | 48 | const char* onGetName() override { return computeName("rects"); } |
commit-bot@chromium.org | 000d732 | 2013-12-05 12:07:44 +0000 | [diff] [blame] | 49 | |
joshualitt | 8a6697a | 2015-09-30 12:11:07 -0700 | [diff] [blame] | 50 | void onDelayedSetup() override { |
commit-bot@chromium.org | 000d732 | 2013-12-05 12:07:44 +0000 | [diff] [blame] | 51 | SkRandom rand; |
| 52 | const SkScalar offset = SK_Scalar1/3; |
| 53 | for (int i = 0; i < N; i++) { |
| 54 | int x = rand.nextU() % W; |
| 55 | int y = rand.nextU() % H; |
| 56 | int w = rand.nextU() % W; |
| 57 | int h = rand.nextU() % H; |
| 58 | w >>= fShift; |
| 59 | h >>= fShift; |
| 60 | x -= w/2; |
| 61 | y -= h/2; |
| 62 | fRects[i].set(SkIntToScalar(x), SkIntToScalar(y), |
| 63 | SkIntToScalar(x+w), SkIntToScalar(y+h)); |
| 64 | fRects[i].offset(offset, offset); |
| 65 | fColors[i] = rand.nextU() | 0xFF808080; |
| 66 | } |
| 67 | } |
| 68 | |
mtklein | a1ebeb2 | 2015-10-01 09:43:39 -0700 | [diff] [blame] | 69 | void onDraw(int loops, SkCanvas* canvas) override { |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 70 | SkPaint paint; |
mike@reedtribe.org | 2ecead5 | 2011-04-02 13:37:23 +0000 | [diff] [blame] | 71 | if (fStroke > 0) { |
| 72 | paint.setStyle(SkPaint::kStroke_Style); |
| 73 | paint.setStrokeWidth(SkIntToScalar(fStroke)); |
| 74 | } |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 75 | for (int i = 0; i < loops; i++) { |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 76 | paint.setColor(fColors[i % N]); |
reed@android.com | 4bc1983 | 2009-01-19 20:08:35 +0000 | [diff] [blame] | 77 | this->setupPaint(&paint); |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 78 | this->drawThisRect(canvas, fRects[i % N], paint); |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 79 | } |
| 80 | } |
Brian Salomon | 3349c6f | 2017-03-01 09:49:58 -0500 | [diff] [blame] | 81 | |
reed@android.com | e9d0060 | 2009-09-02 21:12:42 +0000 | [diff] [blame] | 82 | private: |
Brian Salomon | 3349c6f | 2017-03-01 09:49:58 -0500 | [diff] [blame] | 83 | SkString fBaseName; |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 84 | typedef Benchmark INHERITED; |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 85 | }; |
| 86 | |
reed@google.com | 2d078b6 | 2012-11-15 19:52:07 +0000 | [diff] [blame] | 87 | class SrcModeRectBench : public RectBench { |
| 88 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 89 | SrcModeRectBench() : INHERITED(1, 0) { |
reed | 374772b | 2016-10-05 17:33:02 -0700 | [diff] [blame] | 90 | fMode = SkBlendMode::kSrc; |
reed@google.com | 2d078b6 | 2012-11-15 19:52:07 +0000 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 94 | void setupPaint(SkPaint* paint) override { |
reed@google.com | 2d078b6 | 2012-11-15 19:52:07 +0000 | [diff] [blame] | 95 | this->INHERITED::setupPaint(paint); |
| 96 | // srcmode is most interesting when we're not opaque |
| 97 | paint->setAlpha(0x80); |
reed | 374772b | 2016-10-05 17:33:02 -0700 | [diff] [blame] | 98 | paint->setBlendMode(fMode); |
reed@google.com | 2d078b6 | 2012-11-15 19:52:07 +0000 | [diff] [blame] | 99 | } |
| 100 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 101 | const char* onGetName() override { |
reed@google.com | 2d078b6 | 2012-11-15 19:52:07 +0000 | [diff] [blame] | 102 | fName.set(this->INHERITED::onGetName()); |
| 103 | fName.prepend("srcmode_"); |
| 104 | return fName.c_str(); |
| 105 | } |
| 106 | |
| 107 | private: |
reed | 374772b | 2016-10-05 17:33:02 -0700 | [diff] [blame] | 108 | SkBlendMode fMode; |
Brian Salomon | 3349c6f | 2017-03-01 09:49:58 -0500 | [diff] [blame] | 109 | SkString fName; |
reed@google.com | 2d078b6 | 2012-11-15 19:52:07 +0000 | [diff] [blame] | 110 | |
| 111 | typedef RectBench INHERITED; |
| 112 | }; |
| 113 | |
joshualitt | 8db65a6 | 2015-09-24 12:42:02 -0700 | [diff] [blame] | 114 | class TransparentRectBench : public RectBench { |
| 115 | public: |
| 116 | TransparentRectBench() : INHERITED(1, 0) {} |
| 117 | |
| 118 | protected: |
| 119 | void setupPaint(SkPaint* paint) override { |
| 120 | this->INHERITED::setupPaint(paint); |
| 121 | // draw non opaque rect |
| 122 | paint->setAlpha(0x80); |
| 123 | } |
| 124 | |
| 125 | const char* onGetName() override { |
| 126 | fName.set(this->INHERITED::onGetName()); |
| 127 | fName.prepend("transparent_"); |
| 128 | return fName.c_str(); |
| 129 | } |
| 130 | |
| 131 | private: |
Brian Salomon | 3349c6f | 2017-03-01 09:49:58 -0500 | [diff] [blame] | 132 | SkString fName; |
joshualitt | 8db65a6 | 2015-09-24 12:42:02 -0700 | [diff] [blame] | 133 | typedef RectBench INHERITED; |
| 134 | }; |
| 135 | |
| 136 | |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 137 | class OvalBench : public RectBench { |
reed@android.com | d2c3744 | 2009-01-08 03:00:57 +0000 | [diff] [blame] | 138 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 139 | OvalBench(int shift, int stroke = 0) : RectBench(shift, stroke) {} |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 140 | protected: |
reed | 57b7671 | 2015-09-25 04:49:43 -0700 | [diff] [blame] | 141 | void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) override { |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 142 | c->drawOval(r, p); |
| 143 | } |
reed | 57b7671 | 2015-09-25 04:49:43 -0700 | [diff] [blame] | 144 | const char* onGetName() override { return computeName("ovals"); } |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 145 | }; |
| 146 | |
| 147 | class RRectBench : public RectBench { |
reed@android.com | d2c3744 | 2009-01-08 03:00:57 +0000 | [diff] [blame] | 148 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 149 | RRectBench(int shift, int stroke = 0) : RectBench(shift, stroke) {} |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 150 | protected: |
reed | 57b7671 | 2015-09-25 04:49:43 -0700 | [diff] [blame] | 151 | void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) override { |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 152 | c->drawRoundRect(r, r.width() / 4, r.height() / 4, p); |
| 153 | } |
reed | 57b7671 | 2015-09-25 04:49:43 -0700 | [diff] [blame] | 154 | const char* onGetName() override { return computeName("rrects"); } |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 155 | }; |
| 156 | |
| 157 | class PointsBench : public RectBench { |
| 158 | public: |
| 159 | SkCanvas::PointMode fMode; |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 160 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 161 | PointsBench(SkCanvas::PointMode mode, const char* name) |
| 162 | : RectBench(2) |
| 163 | , fMode(mode) { |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 164 | fName = name; |
| 165 | } |
| 166 | |
| 167 | protected: |
mtklein | a1ebeb2 | 2015-10-01 09:43:39 -0700 | [diff] [blame] | 168 | void onDraw(int loops, SkCanvas* canvas) override { |
agl@chromium.org | 652807b | 2010-04-27 15:47:34 +0000 | [diff] [blame] | 169 | SkScalar gSizes[] = { |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 170 | SkIntToScalar(7), 0 |
| 171 | }; |
agl@chromium.org | 652807b | 2010-04-27 15:47:34 +0000 | [diff] [blame] | 172 | size_t sizes = SK_ARRAY_COUNT(gSizes); |
| 173 | |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 174 | if (FLAGS_strokeWidth >= 0) { |
mtklein@google.com | b87bf83 | 2013-09-10 19:51:10 +0000 | [diff] [blame] | 175 | gSizes[0] = (SkScalar)FLAGS_strokeWidth; |
agl@chromium.org | 652807b | 2010-04-27 15:47:34 +0000 | [diff] [blame] | 176 | sizes = 1; |
| 177 | } |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 178 | |
| 179 | SkPaint paint; |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 180 | paint.setStrokeCap(SkPaint::kRound_Cap); |
agl@chromium.org | 652807b | 2010-04-27 15:47:34 +0000 | [diff] [blame] | 181 | |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 182 | for (int loop = 0; loop < loops; loop++) { |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 183 | for (size_t i = 0; i < sizes; i++) { |
| 184 | paint.setStrokeWidth(gSizes[i]); |
| 185 | this->setupPaint(&paint); |
| 186 | canvas->drawPoints(fMode, N * 2, SkTCast<SkPoint*>(fRects), paint); |
| 187 | paint.setColor(fColors[i % N]); |
| 188 | } |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 189 | } |
| 190 | } |
Brian Salomon | dac5f6b | 2017-02-28 16:11:04 -0500 | [diff] [blame] | 191 | const char* onGetName() override { return fName.c_str(); } |
Brian Salomon | 3349c6f | 2017-03-01 09:49:58 -0500 | [diff] [blame] | 192 | |
| 193 | private: |
| 194 | SkString fName; |
| 195 | |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 196 | }; |
| 197 | |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 198 | /******************************************************************************* |
| 199 | * to bench BlitMask [Opaque, Black, color, shader] |
| 200 | *******************************************************************************/ |
| 201 | |
| 202 | class BlitMaskBench : public RectBench { |
| 203 | public: |
| 204 | enum kMaskType { |
| 205 | kMaskOpaque = 0, |
| 206 | kMaskBlack, |
| 207 | kMaskColor, |
| 208 | KMaskShader |
| 209 | }; |
| 210 | SkCanvas::PointMode fMode; |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 211 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 212 | BlitMaskBench(SkCanvas::PointMode mode, |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 213 | BlitMaskBench::kMaskType type, const char* name) : |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 214 | RectBench(2), fMode(mode), _type(type) { |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 215 | fName = name; |
| 216 | } |
| 217 | |
| 218 | protected: |
mtklein | a1ebeb2 | 2015-10-01 09:43:39 -0700 | [diff] [blame] | 219 | void onDraw(int loops, SkCanvas* canvas) override { |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 220 | SkScalar gSizes[] = { |
| 221 | SkIntToScalar(13), SkIntToScalar(24) |
| 222 | }; |
| 223 | size_t sizes = SK_ARRAY_COUNT(gSizes); |
| 224 | |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 225 | if (FLAGS_strokeWidth >= 0) { |
mtklein@google.com | b87bf83 | 2013-09-10 19:51:10 +0000 | [diff] [blame] | 226 | gSizes[0] = (SkScalar)FLAGS_strokeWidth; |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 227 | sizes = 1; |
| 228 | } |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 229 | SkRandom rand; |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 230 | SkColor color = 0xFF000000; |
| 231 | U8CPU alpha = 0xFF; |
| 232 | SkPaint paint; |
| 233 | paint.setStrokeCap(SkPaint::kRound_Cap); |
| 234 | if (_type == KMaskShader) { |
| 235 | SkBitmap srcBM; |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 236 | srcBM.allocN32Pixels(10, 1); |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 237 | srcBM.eraseColor(0xFF00FF00); |
| 238 | |
reed | c6f28f7 | 2016-03-14 12:22:10 -0700 | [diff] [blame] | 239 | paint.setShader(SkShader::MakeBitmapShader(srcBM, SkShader::kClamp_TileMode, |
| 240 | SkShader::kClamp_TileMode)); |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 241 | } |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 242 | for (int loop = 0; loop < loops; loop++) { |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 243 | for (size_t i = 0; i < sizes; i++) { |
| 244 | switch (_type) { |
| 245 | case kMaskOpaque: |
| 246 | color = fColors[i]; |
| 247 | alpha = 0xFF; |
| 248 | break; |
| 249 | case kMaskBlack: |
| 250 | alpha = 0xFF; |
| 251 | color = 0xFF000000; |
| 252 | break; |
| 253 | case kMaskColor: |
| 254 | color = fColors[i]; |
| 255 | alpha = rand.nextU() & 255; |
| 256 | break; |
| 257 | case KMaskShader: |
| 258 | break; |
| 259 | } |
| 260 | paint.setStrokeWidth(gSizes[i]); |
| 261 | this->setupPaint(&paint); |
| 262 | paint.setColor(color); |
| 263 | paint.setAlpha(alpha); |
| 264 | canvas->drawPoints(fMode, N * 2, SkTCast<SkPoint*>(fRects), paint); |
| 265 | } |
| 266 | } |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 267 | } |
Brian Salomon | dac5f6b | 2017-02-28 16:11:04 -0500 | [diff] [blame] | 268 | const char* onGetName() override { return fName.c_str(); } |
Brian Salomon | 3349c6f | 2017-03-01 09:49:58 -0500 | [diff] [blame] | 269 | |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 270 | private: |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 271 | typedef RectBench INHERITED; |
| 272 | kMaskType _type; |
Brian Salomon | 3349c6f | 2017-03-01 09:49:58 -0500 | [diff] [blame] | 273 | SkString fName; |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 274 | }; |
| 275 | |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 276 | DEF_BENCH(return new RectBench(1);) |
| 277 | DEF_BENCH(return new RectBench(1, 4);) |
| 278 | DEF_BENCH(return new RectBench(3);) |
| 279 | DEF_BENCH(return new RectBench(3, 4);) |
| 280 | DEF_BENCH(return new OvalBench(1);) |
| 281 | DEF_BENCH(return new OvalBench(3);) |
| 282 | DEF_BENCH(return new OvalBench(1, 4);) |
| 283 | DEF_BENCH(return new OvalBench(3, 4);) |
| 284 | DEF_BENCH(return new RRectBench(1);) |
| 285 | DEF_BENCH(return new RRectBench(1, 4);) |
| 286 | DEF_BENCH(return new RRectBench(3);) |
| 287 | DEF_BENCH(return new RRectBench(3, 4);) |
| 288 | DEF_BENCH(return new PointsBench(SkCanvas::kPoints_PointMode, "points");) |
| 289 | DEF_BENCH(return new PointsBench(SkCanvas::kLines_PointMode, "lines");) |
| 290 | DEF_BENCH(return new PointsBench(SkCanvas::kPolygon_PointMode, "polygon");) |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 291 | |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 292 | DEF_BENCH(return new SrcModeRectBench();) |
robertphillips@google.com | 370d835 | 2013-05-02 13:57:52 +0000 | [diff] [blame] | 293 | |
joshualitt | 8db65a6 | 2015-09-24 12:42:02 -0700 | [diff] [blame] | 294 | DEF_BENCH(return new TransparentRectBench();) |
| 295 | |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 296 | /* init the blitmask bench |
| 297 | */ |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 298 | DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, |
| 299 | BlitMaskBench::kMaskOpaque, |
| 300 | "maskopaque");) |
| 301 | DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, |
| 302 | BlitMaskBench::kMaskBlack, |
| 303 | "maskblack");) |
| 304 | DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, |
| 305 | BlitMaskBench::kMaskColor, |
| 306 | "maskcolor");) |
| 307 | DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, |
| 308 | BlitMaskBench::KMaskShader, |
| 309 | "maskshader");) |