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