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