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