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