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 | */ |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 7 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "bench/Benchmark.h" |
| 9 | #include "include/core/SkBitmap.h" |
| 10 | #include "include/core/SkCanvas.h" |
| 11 | #include "include/core/SkColorPriv.h" |
| 12 | #include "include/core/SkPaint.h" |
| 13 | #include "include/core/SkString.h" |
| 14 | #include "include/utils/SkRandom.h" |
| 15 | #include "tools/ToolUtils.h" |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 16 | |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 17 | /* Variants for bitmaps |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 18 | |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 19 | - src depth (32 w+w/o alpha), 565, 4444, index, a8 |
| 20 | - paint options: filtering, dither, alpha |
| 21 | - matrix options: translate, scale, rotate, persp |
| 22 | - tiling: none, repeat, mirror, clamp |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 23 | |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 24 | */ |
| 25 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 26 | class BitmapBench : public Benchmark { |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 27 | const SkColorType fColorType; |
| 28 | const SkAlphaType fAlphaType; |
| 29 | const bool fForceUpdate; //bitmap marked as dirty before each draw. forces bitmap to be updated on device cache |
| 30 | const bool fIsVolatile; |
mtklein | 14e4d39 | 2014-10-23 14:35:01 -0700 | [diff] [blame] | 31 | const bool fDoScale; |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 32 | |
| 33 | SkBitmap fBitmap; |
| 34 | SkPaint fPaint; |
| 35 | SkString fName; |
| 36 | |
djsollen@google.com | c2532dd | 2013-04-09 18:06:06 +0000 | [diff] [blame] | 37 | enum { W = 128 }; |
| 38 | enum { H = 128 }; |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 39 | public: |
mtklein | 14e4d39 | 2014-10-23 14:35:01 -0700 | [diff] [blame] | 40 | BitmapBench(SkColorType ct, SkAlphaType at, bool forceUpdate, bool isVolatile, bool doScale) |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 41 | : fColorType(ct) |
| 42 | , fAlphaType(at) |
djsollen@google.com | c2532dd | 2013-04-09 18:06:06 +0000 | [diff] [blame] | 43 | , fForceUpdate(forceUpdate) |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 44 | , fIsVolatile(isVolatile) |
mtklein | 14e4d39 | 2014-10-23 14:35:01 -0700 | [diff] [blame] | 45 | , fDoScale(doScale) |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 46 | {} |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 47 | |
| 48 | protected: |
mtklein | f059900 | 2015-07-13 06:18:39 -0700 | [diff] [blame] | 49 | const char* onGetName() override { |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 50 | fName.set("bitmap"); |
Mike Klein | ea3f014 | 2019-03-20 11:12:10 -0500 | [diff] [blame] | 51 | fName.appendf("_%s%s", |
| 52 | ToolUtils::colortype_name(fColorType), |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 53 | kOpaque_SkAlphaType == fAlphaType ? "" : "_A"); |
mtklein | 14e4d39 | 2014-10-23 14:35:01 -0700 | [diff] [blame] | 54 | if (fDoScale) { |
| 55 | fName.append("_scale"); |
| 56 | } |
| 57 | if (fForceUpdate) { |
junov@google.com | 4ee7ae5 | 2011-06-30 17:30:49 +0000 | [diff] [blame] | 58 | fName.append("_update"); |
mtklein | 14e4d39 | 2014-10-23 14:35:01 -0700 | [diff] [blame] | 59 | } |
| 60 | if (fIsVolatile) { |
junov@google.com | 4ee7ae5 | 2011-06-30 17:30:49 +0000 | [diff] [blame] | 61 | fName.append("_volatile"); |
mtklein | 14e4d39 | 2014-10-23 14:35:01 -0700 | [diff] [blame] | 62 | } |
junov@google.com | 4ee7ae5 | 2011-06-30 17:30:49 +0000 | [diff] [blame] | 63 | |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 64 | return fName.c_str(); |
| 65 | } |
| 66 | |
joshualitt | 8a6697a | 2015-09-30 12:11:07 -0700 | [diff] [blame] | 67 | void onDelayedSetup() override { |
djsollen@google.com | c2532dd | 2013-04-09 18:06:06 +0000 | [diff] [blame] | 68 | SkBitmap bm; |
| 69 | |
Mike Reed | a920d36 | 2017-07-03 13:36:17 -0400 | [diff] [blame] | 70 | bm.allocPixels(SkImageInfo::Make(W, H, fColorType, fAlphaType)); |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 71 | bm.eraseColor(kOpaque_SkAlphaType == fAlphaType ? SK_ColorBLACK : 0); |
djsollen@google.com | c2532dd | 2013-04-09 18:06:06 +0000 | [diff] [blame] | 72 | |
mtklein | f059900 | 2015-07-13 06:18:39 -0700 | [diff] [blame] | 73 | this->onDrawIntoBitmap(bm); |
djsollen@google.com | c2532dd | 2013-04-09 18:06:06 +0000 | [diff] [blame] | 74 | |
Mike Reed | a920d36 | 2017-07-03 13:36:17 -0400 | [diff] [blame] | 75 | fBitmap = bm; |
djsollen@google.com | c2532dd | 2013-04-09 18:06:06 +0000 | [diff] [blame] | 76 | fBitmap.setIsVolatile(fIsVolatile); |
| 77 | } |
| 78 | |
mtklein | a1ebeb2 | 2015-10-01 09:43:39 -0700 | [diff] [blame] | 79 | void onDraw(int loops, SkCanvas* canvas) override { |
mtklein | 14e4d39 | 2014-10-23 14:35:01 -0700 | [diff] [blame] | 80 | if (fDoScale) { |
| 81 | canvas->scale(.99f, .99f); |
| 82 | } |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 83 | SkIPoint dim = this->getSize(); |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 84 | SkRandom rand; |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 85 | |
| 86 | SkPaint paint(fPaint); |
| 87 | this->setupPaint(&paint); |
| 88 | |
| 89 | const SkBitmap& bitmap = fBitmap; |
| 90 | const SkScalar x0 = SkIntToScalar(-bitmap.width() / 2); |
| 91 | const SkScalar y0 = SkIntToScalar(-bitmap.height() / 2); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 92 | |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 93 | for (int i = 0; i < loops; i++) { |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 94 | SkScalar x = x0 + rand.nextUScalar1() * dim.fX; |
| 95 | SkScalar y = y0 + rand.nextUScalar1() * dim.fY; |
junov@google.com | 4ee7ae5 | 2011-06-30 17:30:49 +0000 | [diff] [blame] | 96 | |
| 97 | if (fForceUpdate) |
| 98 | bitmap.notifyPixelsChanged(); |
| 99 | |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 100 | canvas->drawBitmap(bitmap, x, y, &paint); |
| 101 | } |
| 102 | } |
| 103 | |
mtklein | f059900 | 2015-07-13 06:18:39 -0700 | [diff] [blame] | 104 | virtual void onDrawIntoBitmap(const SkBitmap& bm) { |
djsollen@google.com | c2532dd | 2013-04-09 18:06:06 +0000 | [diff] [blame] | 105 | const int w = bm.width(); |
| 106 | const int h = bm.height(); |
| 107 | |
| 108 | SkCanvas canvas(bm); |
| 109 | SkPaint p; |
| 110 | p.setAntiAlias(true); |
| 111 | p.setColor(SK_ColorRED); |
| 112 | canvas.drawCircle(SkIntToScalar(w)/2, SkIntToScalar(h)/2, |
| 113 | SkIntToScalar(SkMin32(w, h))*3/8, p); |
| 114 | |
| 115 | SkRect r; |
| 116 | r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h)); |
| 117 | p.setStyle(SkPaint::kStroke_Style); |
| 118 | p.setStrokeWidth(SkIntToScalar(4)); |
| 119 | p.setColor(SK_ColorBLUE); |
| 120 | canvas.drawRect(r, p); |
| 121 | } |
| 122 | |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 123 | private: |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 124 | typedef Benchmark INHERITED; |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 125 | }; |
| 126 | |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 127 | /** Explicitly invoke some filter types to improve coverage of acceleration |
| 128 | procs. */ |
| 129 | |
reed@google.com | ef77ec2 | 2013-05-29 15:39:54 +0000 | [diff] [blame] | 130 | enum Flags { |
| 131 | kScale_Flag = 1 << 0, |
| 132 | kRotate_Flag = 1 << 1, |
| 133 | kBilerp_Flag = 1 << 2, |
| 134 | kBicubic_Flag = 1 << 3, |
| 135 | }; |
| 136 | |
| 137 | static bool isBilerp(uint32_t flags) { |
| 138 | return (flags & (kBilerp_Flag | kBicubic_Flag)) == (kBilerp_Flag); |
| 139 | } |
| 140 | |
| 141 | static bool isBicubic(uint32_t flags) { |
| 142 | return (flags & (kBilerp_Flag | kBicubic_Flag)) == (kBilerp_Flag | kBicubic_Flag); |
| 143 | } |
| 144 | |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 145 | class FilterBitmapBench : public BitmapBench { |
reed@google.com | ef77ec2 | 2013-05-29 15:39:54 +0000 | [diff] [blame] | 146 | uint32_t fFlags; |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 147 | SkString fFullName; |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 148 | public: |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 149 | FilterBitmapBench(SkColorType ct, SkAlphaType at, |
reed@google.com | ef77ec2 | 2013-05-29 15:39:54 +0000 | [diff] [blame] | 150 | bool forceUpdate, bool isVolitile, uint32_t flags) |
mtklein | 14e4d39 | 2014-10-23 14:35:01 -0700 | [diff] [blame] | 151 | : INHERITED(ct, at, forceUpdate, isVolitile, false) |
reed@google.com | ef77ec2 | 2013-05-29 15:39:54 +0000 | [diff] [blame] | 152 | , fFlags(flags) { |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | protected: |
mtklein | f059900 | 2015-07-13 06:18:39 -0700 | [diff] [blame] | 156 | const char* onGetName() override { |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 157 | fFullName.set(INHERITED::onGetName()); |
reed@google.com | ef77ec2 | 2013-05-29 15:39:54 +0000 | [diff] [blame] | 158 | if (fFlags & kScale_Flag) { |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 159 | fFullName.append("_scale"); |
reed@google.com | ef77ec2 | 2013-05-29 15:39:54 +0000 | [diff] [blame] | 160 | } |
| 161 | if (fFlags & kRotate_Flag) { |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 162 | fFullName.append("_rotate"); |
reed@google.com | ef77ec2 | 2013-05-29 15:39:54 +0000 | [diff] [blame] | 163 | } |
| 164 | if (isBilerp(fFlags)) { |
| 165 | fFullName.append("_bilerp"); |
| 166 | } else if (isBicubic(fFlags)) { |
| 167 | fFullName.append("_bicubic"); |
| 168 | } |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 169 | |
| 170 | return fFullName.c_str(); |
| 171 | } |
| 172 | |
mtklein | a1ebeb2 | 2015-10-01 09:43:39 -0700 | [diff] [blame] | 173 | void onDraw(int loops, SkCanvas* canvas) override { |
Mike Reed | 3661bc9 | 2017-02-22 13:21:42 -0500 | [diff] [blame] | 174 | SkISize dim = canvas->getBaseLayerSize(); |
reed@google.com | ef77ec2 | 2013-05-29 15:39:54 +0000 | [diff] [blame] | 175 | if (fFlags & kScale_Flag) { |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 176 | const SkScalar x = SkIntToScalar(dim.fWidth) / 2; |
| 177 | const SkScalar y = SkIntToScalar(dim.fHeight) / 2; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 178 | |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 179 | canvas->translate(x, y); |
| 180 | // just enough so we can't take the sprite case |
| 181 | canvas->scale(SK_Scalar1 * 99/100, SK_Scalar1 * 99/100); |
| 182 | canvas->translate(-x, -y); |
| 183 | } |
reed@google.com | ef77ec2 | 2013-05-29 15:39:54 +0000 | [diff] [blame] | 184 | if (fFlags & kRotate_Flag) { |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 185 | const SkScalar x = SkIntToScalar(dim.fWidth) / 2; |
| 186 | const SkScalar y = SkIntToScalar(dim.fHeight) / 2; |
bungeman | 7438bfc | 2016-07-12 15:01:19 -0700 | [diff] [blame] | 187 | canvas->rotate(SkIntToScalar(35), x, y); |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 188 | } |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 189 | INHERITED::onDraw(loops, canvas); |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 190 | } |
| 191 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 192 | void setupPaint(SkPaint* paint) override { |
reed@google.com | 9cfc83c | 2013-07-22 17:18:18 +0000 | [diff] [blame] | 193 | this->INHERITED::setupPaint(paint); |
| 194 | |
| 195 | int index = 0; |
| 196 | if (fFlags & kBilerp_Flag) { |
| 197 | index |= 1; |
| 198 | } |
| 199 | if (fFlags & kBicubic_Flag) { |
| 200 | index |= 2; |
| 201 | } |
reed | 93a1215 | 2015-03-16 10:08:34 -0700 | [diff] [blame] | 202 | static const SkFilterQuality gQualitys[] = { |
| 203 | kNone_SkFilterQuality, |
| 204 | kLow_SkFilterQuality, |
| 205 | kMedium_SkFilterQuality, |
| 206 | kHigh_SkFilterQuality |
reed@google.com | 9cfc83c | 2013-07-22 17:18:18 +0000 | [diff] [blame] | 207 | }; |
reed | 93a1215 | 2015-03-16 10:08:34 -0700 | [diff] [blame] | 208 | paint->setFilterQuality(gQualitys[index]); |
reed@google.com | 9cfc83c | 2013-07-22 17:18:18 +0000 | [diff] [blame] | 209 | } |
| 210 | |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 211 | private: |
| 212 | typedef BitmapBench INHERITED; |
| 213 | }; |
| 214 | |
djsollen@google.com | c2532dd | 2013-04-09 18:06:06 +0000 | [diff] [blame] | 215 | /** Verify optimizations that test source alpha values. */ |
| 216 | |
| 217 | class SourceAlphaBitmapBench : public BitmapBench { |
| 218 | public: |
| 219 | enum SourceAlpha { kOpaque_SourceAlpha, kTransparent_SourceAlpha, |
| 220 | kTwoStripes_SourceAlpha, kThreeStripes_SourceAlpha}; |
| 221 | private: |
| 222 | SkString fFullName; |
| 223 | SourceAlpha fSourceAlpha; |
| 224 | public: |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 225 | SourceAlphaBitmapBench(SourceAlpha alpha, SkColorType ct, |
reed@google.com | ef77ec2 | 2013-05-29 15:39:54 +0000 | [diff] [blame] | 226 | bool forceUpdate = false, bool bitmapVolatile = false) |
mtklein | 14e4d39 | 2014-10-23 14:35:01 -0700 | [diff] [blame] | 227 | : INHERITED(ct, kPremul_SkAlphaType, forceUpdate, bitmapVolatile, false) |
djsollen@google.com | c2532dd | 2013-04-09 18:06:06 +0000 | [diff] [blame] | 228 | , fSourceAlpha(alpha) { |
| 229 | } |
| 230 | |
| 231 | protected: |
mtklein | f059900 | 2015-07-13 06:18:39 -0700 | [diff] [blame] | 232 | const char* onGetName() override { |
djsollen@google.com | c2532dd | 2013-04-09 18:06:06 +0000 | [diff] [blame] | 233 | fFullName.set(INHERITED::onGetName()); |
| 234 | |
| 235 | if (fSourceAlpha == kOpaque_SourceAlpha) { |
| 236 | fFullName.append("_source_opaque"); |
| 237 | } else if (fSourceAlpha == kTransparent_SourceAlpha) { |
| 238 | fFullName.append("_source_transparent"); |
| 239 | } else if (fSourceAlpha == kTwoStripes_SourceAlpha) { |
| 240 | fFullName.append("_source_stripes_two"); |
| 241 | } else if (fSourceAlpha == kThreeStripes_SourceAlpha) { |
| 242 | fFullName.append("_source_stripes_three"); |
| 243 | } |
| 244 | |
| 245 | return fFullName.c_str(); |
| 246 | } |
| 247 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 248 | void onDrawIntoBitmap(const SkBitmap& bm) override { |
djsollen@google.com | c2532dd | 2013-04-09 18:06:06 +0000 | [diff] [blame] | 249 | const int w = bm.width(); |
| 250 | const int h = bm.height(); |
| 251 | |
| 252 | if (kOpaque_SourceAlpha == fSourceAlpha) { |
| 253 | bm.eraseColor(SK_ColorBLACK); |
| 254 | } else if (kTransparent_SourceAlpha == fSourceAlpha) { |
| 255 | bm.eraseColor(0); |
| 256 | } else if (kTwoStripes_SourceAlpha == fSourceAlpha) { |
| 257 | bm.eraseColor(0); |
| 258 | |
| 259 | SkCanvas canvas(bm); |
| 260 | SkPaint p; |
| 261 | p.setAntiAlias(false); |
| 262 | p.setStyle(SkPaint::kFill_Style); |
| 263 | p.setColor(SK_ColorRED); |
| 264 | |
| 265 | // Draw red vertical stripes on transparent background |
| 266 | SkRect r; |
| 267 | for (int x = 0; x < w; x+=2) |
| 268 | { |
| 269 | r.set(SkIntToScalar(x), 0, SkIntToScalar(x+1), SkIntToScalar(h)); |
| 270 | canvas.drawRect(r, p); |
| 271 | } |
| 272 | |
| 273 | } else if (kThreeStripes_SourceAlpha == fSourceAlpha) { |
| 274 | bm.eraseColor(0); |
| 275 | |
| 276 | SkCanvas canvas(bm); |
| 277 | SkPaint p; |
| 278 | p.setAntiAlias(false); |
| 279 | p.setStyle(SkPaint::kFill_Style); |
| 280 | |
| 281 | // Draw vertical stripes on transparent background with a pattern |
| 282 | // where the first pixel is fully transparent, the next is semi-transparent |
| 283 | // and the third is fully opaque. |
| 284 | SkRect r; |
| 285 | for (int x = 0; x < w; x++) |
| 286 | { |
| 287 | if (x % 3 == 0) { |
| 288 | continue; // Keep transparent |
| 289 | } else if (x % 3 == 1) { |
| 290 | p.setColor(SkColorSetARGB(127, 127, 127, 127)); // Semi-transparent |
| 291 | } else if (x % 3 == 2) { |
| 292 | p.setColor(SK_ColorRED); // Opaque |
| 293 | } |
| 294 | r.set(SkIntToScalar(x), 0, SkIntToScalar(x+1), SkIntToScalar(h)); |
| 295 | canvas.drawRect(r, p); |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | private: |
| 301 | typedef BitmapBench INHERITED; |
| 302 | }; |
reed@google.com | 2ece287 | 2013-05-28 20:48:14 +0000 | [diff] [blame] | 303 | |
mtklein | 14e4d39 | 2014-10-23 14:35:01 -0700 | [diff] [blame] | 304 | DEF_BENCH( return new BitmapBench(kN32_SkColorType, kPremul_SkAlphaType, false, false, false); ) |
| 305 | DEF_BENCH( return new BitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, false, false, false); ) |
| 306 | DEF_BENCH( return new BitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, false, false, true); ) |
| 307 | DEF_BENCH( return new BitmapBench(kRGB_565_SkColorType, kOpaque_SkAlphaType, false, false, false); ) |
mtklein | 14e4d39 | 2014-10-23 14:35:01 -0700 | [diff] [blame] | 308 | DEF_BENCH( return new BitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, true, true, false); ) |
| 309 | DEF_BENCH( return new BitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, true, false, false); ) |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 310 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 311 | // scale filter -> S32_opaque_D32_filter_DX_{SSE2,SSSE3} and Fact9 is also for S32_D16_filter_DX_SSE2 |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 312 | DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, false, false, kScale_Flag | kBilerp_Flag); ) |
| 313 | DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, false, false, kScale_Flag | kBilerp_Flag); ) |
| 314 | DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, true, true, kScale_Flag | kBilerp_Flag); ) |
| 315 | DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, true, false, kScale_Flag | kBilerp_Flag); ) |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 316 | |
Yuqian Li | 24e963d | 2017-12-06 11:30:58 -0500 | [diff] [blame] | 317 | // The following two cases test the performance regression of b/70172912 . |
| 318 | DEF_BENCH( return new FilterBitmapBench(kRGB_565_SkColorType, kOpaque_SkAlphaType, false, false, kScale_Flag | kBilerp_Flag); ) |
| 319 | DEF_BENCH( return new BitmapBench(kRGB_565_SkColorType, kOpaque_SkAlphaType, false, false, true); ) |
| 320 | |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 321 | // scale rotate filter -> S32_opaque_D32_filter_DXDY_{SSE2,SSSE3} |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 322 | DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, false, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); ) |
| 323 | DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, false, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); ) |
| 324 | DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, true, true, kScale_Flag | kRotate_Flag | kBilerp_Flag); ) |
| 325 | DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, true, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); ) |
reed@google.com | ef77ec2 | 2013-05-29 15:39:54 +0000 | [diff] [blame] | 326 | |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 327 | DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, false, false, kScale_Flag | kBilerp_Flag | kBicubic_Flag); ) |
| 328 | DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, false, false, kScale_Flag | kRotate_Flag | kBilerp_Flag | kBicubic_Flag); ) |
tomhudson@google.com | c3be34d | 2012-05-15 20:09:33 +0000 | [diff] [blame] | 329 | |
djsollen@google.com | c2532dd | 2013-04-09 18:06:06 +0000 | [diff] [blame] | 330 | // source alpha tests -> S32A_Opaque_BlitRow32_{arm,neon} |
reed | 6c22573 | 2014-06-09 19:52:07 -0700 | [diff] [blame] | 331 | DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kOpaque_SourceAlpha, kN32_SkColorType); ) |
| 332 | DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kTransparent_SourceAlpha, kN32_SkColorType); ) |
| 333 | DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kTwoStripes_SourceAlpha, kN32_SkColorType); ) |
| 334 | DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kThreeStripes_SourceAlpha, kN32_SkColorType); ) |