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