robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 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 | */ |
| 7 | |
| 8 | #include "SkBenchmark.h" |
| 9 | #include "SkCanvas.h" |
| 10 | #include "SkPaint.h" |
| 11 | #include "SkRandom.h" |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 12 | #include "SkShader.h" |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 13 | #include "SkString.h" |
| 14 | |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 15 | // This bench simulates the calls Skia sees from various HTML5 canvas |
| 16 | // game bench marks |
| 17 | class GameBench : public SkBenchmark { |
| 18 | public: |
| 19 | enum Type { |
skia.committer@gmail.com | 0f20a3f | 2013-05-10 07:01:04 +0000 | [diff] [blame] | 20 | kScale_Type, |
| 21 | kTranslate_Type, |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 22 | kRotate_Type |
| 23 | }; |
| 24 | |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 25 | enum Clear { |
| 26 | kFull_Clear, |
| 27 | kPartial_Clear |
| 28 | }; |
| 29 | |
skia.committer@gmail.com | 26da7f0 | 2013-06-01 07:01:39 +0000 | [diff] [blame] | 30 | GameBench(void* param, Type type, Clear clear, |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 31 | bool aligned = false, bool useAtlas = false, |
| 32 | bool useDrawVertices = false) |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 33 | : INHERITED(param) |
| 34 | , fType(type) |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 35 | , fClear(clear) |
robertphillips@google.com | 347fd4e | 2013-05-15 14:18:32 +0000 | [diff] [blame] | 36 | , fAligned(aligned) |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 37 | , fUseAtlas(useAtlas) |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 38 | , fUseDrawVertices(useDrawVertices) |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 39 | , fName("game") |
| 40 | , fNumSaved(0) |
| 41 | , fInitialized(false) { |
| 42 | |
| 43 | switch (fType) { |
| 44 | case kScale_Type: |
| 45 | fName.append("_scale"); |
| 46 | break; |
| 47 | case kTranslate_Type: |
| 48 | fName.append("_trans"); |
| 49 | break; |
| 50 | case kRotate_Type: |
| 51 | fName.append("_rot"); |
| 52 | break; |
| 53 | }; |
| 54 | |
robertphillips@google.com | 347fd4e | 2013-05-15 14:18:32 +0000 | [diff] [blame] | 55 | if (aligned) { |
| 56 | fName.append("_aligned"); |
| 57 | } |
| 58 | |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 59 | if (kPartial_Clear == clear) { |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 60 | fName.append("_partial"); |
| 61 | } else { |
| 62 | fName.append("_full"); |
| 63 | } |
| 64 | |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 65 | if (useAtlas) { |
| 66 | fName.append("_atlas"); |
| 67 | } |
| 68 | |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 69 | if (useDrawVertices) { |
| 70 | fName.append("_drawVerts"); |
| 71 | } |
| 72 | |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 73 | // It's HTML 5 canvas, so always AA |
| 74 | fName.append("_aa"); |
| 75 | } |
| 76 | |
| 77 | protected: |
| 78 | virtual const char* onGetName() SK_OVERRIDE { |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 79 | return fName.c_str(); |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | virtual void onPreDraw() SK_OVERRIDE { |
| 83 | if (!fInitialized) { |
| 84 | this->makeCheckerboard(); |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 85 | this->makeAtlas(); |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 86 | fInitialized = true; |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 91 | SkMWCRandom scaleRand; |
| 92 | SkMWCRandom transRand; |
| 93 | SkMWCRandom rotRand; |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 94 | |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 95 | int width, height; |
| 96 | if (fUseAtlas) { |
| 97 | width = kAtlasCellWidth; |
| 98 | height = kAtlasCellHeight; |
| 99 | } else { |
| 100 | width = kCheckerboardWidth; |
| 101 | height = kCheckerboardHeight; |
| 102 | } |
| 103 | |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 104 | SkPaint clearPaint; |
| 105 | clearPaint.setColor(0xFF000000); |
| 106 | clearPaint.setAntiAlias(true); |
| 107 | |
| 108 | SkISize size = canvas->getDeviceSize(); |
| 109 | |
| 110 | SkScalar maxTransX, maxTransY; |
| 111 | |
| 112 | if (kScale_Type == fType) { |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 113 | maxTransX = size.fWidth - (1.5f * width); |
| 114 | maxTransY = size.fHeight - (1.5f * height); |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 115 | } else if (kTranslate_Type == fType) { |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 116 | maxTransX = SkIntToScalar(size.fWidth - width); |
| 117 | maxTransY = SkIntToScalar(size.fHeight - height); |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 118 | } else { |
| 119 | SkASSERT(kRotate_Type == fType); |
| 120 | // Yes, some rotations will be off the top and left sides |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 121 | maxTransX = size.fWidth - SK_ScalarSqrt2 * height; |
| 122 | maxTransY = size.fHeight - SK_ScalarSqrt2 * height; |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | SkMatrix mat; |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 126 | SkRect dst = { 0, 0, SkIntToScalar(width), SkIntToScalar(height) }; |
| 127 | SkRect clearRect = { -1.0f, -1.0f, width+1.0f, height+1.0f }; |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 128 | SkPoint verts[4] = { // for drawVertices path |
| 129 | { 0, 0 }, |
| 130 | { 0, SkIntToScalar(height) }, |
| 131 | { SkIntToScalar(width), SkIntToScalar(height) }, |
| 132 | { SkIntToScalar(width), 0 } |
| 133 | }; |
| 134 | uint16_t indices[6] = { 0, 1, 2, 0, 2, 3 }; |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 135 | |
| 136 | SkPaint p; |
| 137 | p.setColor(0xFF000000); |
| 138 | p.setFilterBitmap(true); |
| 139 | |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 140 | SkPaint p2; // for drawVertices path |
| 141 | p2.setColor(0xFF000000); |
| 142 | p2.setFilterBitmap(true); |
skia.committer@gmail.com | 5d4b773 | 2013-08-01 07:01:05 +0000 | [diff] [blame] | 143 | p2.setShader(SkShader::CreateBitmapShader(fAtlas, |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 144 | SkShader::kClamp_TileMode, |
| 145 | SkShader::kClamp_TileMode))->unref(); |
| 146 | |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 147 | for (int i = 0; i < kNumRects; ++i, ++fNumSaved) { |
| 148 | |
| 149 | if (0 == i % kNumBeforeClear) { |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 150 | if (kPartial_Clear == fClear) { |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 151 | for (int j = 0; j < fNumSaved; ++j) { |
| 152 | canvas->setMatrix(SkMatrix::I()); |
| 153 | mat.setTranslate(fSaved[j][0], fSaved[j][1]); |
| 154 | |
| 155 | if (kScale_Type == fType) { |
| 156 | mat.preScale(fSaved[j][2], fSaved[j][2]); |
| 157 | } else if (kRotate_Type == fType) { |
| 158 | mat.preRotate(fSaved[j][2]); |
| 159 | } |
| 160 | |
| 161 | canvas->concat(mat); |
| 162 | canvas->drawRect(clearRect, clearPaint); |
| 163 | } |
| 164 | } else { |
| 165 | canvas->clear(0xFF000000); |
| 166 | } |
| 167 | |
| 168 | fNumSaved = 0; |
| 169 | } |
| 170 | |
| 171 | SkASSERT(fNumSaved < kNumBeforeClear); |
| 172 | |
| 173 | canvas->setMatrix(SkMatrix::I()); |
| 174 | |
| 175 | fSaved[fNumSaved][0] = transRand.nextRangeScalar(0.0f, maxTransX); |
| 176 | fSaved[fNumSaved][1] = transRand.nextRangeScalar(0.0f, maxTransY); |
robertphillips@google.com | 347fd4e | 2013-05-15 14:18:32 +0000 | [diff] [blame] | 177 | if (fAligned) { |
| 178 | // make the translations integer aligned |
| 179 | fSaved[fNumSaved][0] = SkScalarFloorToScalar(fSaved[fNumSaved][0]); |
| 180 | fSaved[fNumSaved][1] = SkScalarFloorToScalar(fSaved[fNumSaved][1]); |
| 181 | } |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 182 | |
| 183 | mat.setTranslate(fSaved[fNumSaved][0], fSaved[fNumSaved][1]); |
| 184 | |
| 185 | if (kScale_Type == fType) { |
| 186 | fSaved[fNumSaved][2] = scaleRand.nextRangeScalar(0.5f, 1.5f); |
| 187 | mat.preScale(fSaved[fNumSaved][2], fSaved[fNumSaved][2]); |
| 188 | } else if (kRotate_Type == fType) { |
| 189 | fSaved[fNumSaved][2] = rotRand.nextRangeScalar(0.0f, 360.0f); |
| 190 | mat.preRotate(fSaved[fNumSaved][2]); |
| 191 | } |
| 192 | |
| 193 | canvas->concat(mat); |
skia.committer@gmail.com | 26da7f0 | 2013-06-01 07:01:39 +0000 | [diff] [blame] | 194 | if (fUseAtlas) { |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 195 | static int curCell = 0; |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 196 | SkIRect src = fAtlasRects[curCell % (kNumAtlasedX)][curCell / (kNumAtlasedX)]; |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 197 | curCell = (curCell + 1) % (kNumAtlasedX*kNumAtlasedY); |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 198 | |
| 199 | if (fUseDrawVertices) { |
skia.committer@gmail.com | 5d4b773 | 2013-08-01 07:01:05 +0000 | [diff] [blame] | 200 | SkPoint uvs[4] = { |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 201 | { SkIntToScalar(src.fLeft), SkIntToScalar(src.fBottom) }, |
| 202 | { SkIntToScalar(src.fLeft), SkIntToScalar(src.fTop) }, |
| 203 | { SkIntToScalar(src.fRight), SkIntToScalar(src.fTop) }, |
| 204 | { SkIntToScalar(src.fRight), SkIntToScalar(src.fBottom) }, |
| 205 | }; |
| 206 | canvas->drawVertices(SkCanvas::kTriangles_VertexMode, |
skia.committer@gmail.com | 5d4b773 | 2013-08-01 07:01:05 +0000 | [diff] [blame] | 207 | 4, verts, uvs, NULL, NULL, |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 208 | indices, 6, p2); |
| 209 | } else { |
| 210 | canvas->drawBitmapRect(fAtlas, &src, dst, &p); |
| 211 | } |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 212 | } else { |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 213 | canvas->drawBitmapRect(fCheckerboard, NULL, dst, &p); |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 214 | } |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 215 | } |
| 216 | } |
| 217 | |
| 218 | private: |
| 219 | static const int kCheckerboardWidth = 64; |
| 220 | static const int kCheckerboardHeight = 128; |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 221 | |
| 222 | static const int kAtlasCellWidth = 48; |
| 223 | static const int kAtlasCellHeight = 36; |
| 224 | static const int kNumAtlasedX = 5; |
| 225 | static const int kNumAtlasedY = 5; |
| 226 | static const int kAtlasSpacer = 2; |
| 227 | static const int kTotAtlasWidth = kNumAtlasedX * kAtlasCellWidth + |
| 228 | (kNumAtlasedX+1) * kAtlasSpacer; |
| 229 | static const int kTotAtlasHeight = kNumAtlasedY * kAtlasCellHeight + |
| 230 | (kNumAtlasedY+1) * kAtlasSpacer; |
| 231 | |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 232 | #ifdef SK_DEBUG |
| 233 | static const int kNumRects = 100; |
| 234 | static const int kNumBeforeClear = 10; |
| 235 | #else |
| 236 | static const int kNumRects = 5000; |
| 237 | static const int kNumBeforeClear = 300; |
| 238 | #endif |
| 239 | |
| 240 | |
| 241 | Type fType; |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 242 | Clear fClear; |
robertphillips@google.com | 347fd4e | 2013-05-15 14:18:32 +0000 | [diff] [blame] | 243 | bool fAligned; |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 244 | bool fUseAtlas; |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 245 | bool fUseDrawVertices; |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 246 | SkString fName; |
| 247 | int fNumSaved; // num draws stored in 'fSaved' |
| 248 | bool fInitialized; |
| 249 | |
| 250 | // 0 & 1 are always x & y translate. 2 is either scale or rotate. |
| 251 | SkScalar fSaved[kNumBeforeClear][3]; |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 252 | |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 253 | SkBitmap fCheckerboard; |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 254 | SkBitmap fAtlas; |
| 255 | SkIRect fAtlasRects[kNumAtlasedX][kNumAtlasedY]; |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 256 | |
| 257 | // Note: the resulting checker board has transparency |
| 258 | void makeCheckerboard() { |
robertphillips@google.com | 6d58ad3 | 2013-05-09 19:08:57 +0000 | [diff] [blame] | 259 | static int kCheckSize = 16; |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 260 | |
| 261 | fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, |
| 262 | kCheckerboardWidth, kCheckerboardHeight); |
| 263 | fCheckerboard.allocPixels(); |
| 264 | SkAutoLockPixels lock(fCheckerboard); |
robertphillips@google.com | 6d58ad3 | 2013-05-09 19:08:57 +0000 | [diff] [blame] | 265 | for (int y = 0; y < kCheckerboardHeight; ++y) { |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 266 | int even = (y / kCheckSize) % 2; |
| 267 | |
| 268 | SkPMColor* scanline = fCheckerboard.getAddr32(0, y); |
| 269 | |
robertphillips@google.com | 6d58ad3 | 2013-05-09 19:08:57 +0000 | [diff] [blame] | 270 | for (int x = 0; x < kCheckerboardWidth; ++x) { |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 271 | if (even == (x / kCheckSize) % 2) { |
| 272 | *scanline++ = 0xFFFF0000; |
| 273 | } else { |
| 274 | *scanline++ = 0x00000000; |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 280 | // Note: the resulting atlas has transparency |
| 281 | void makeAtlas() { |
| 282 | SkMWCRandom rand; |
| 283 | |
| 284 | SkColor colors[kNumAtlasedX][kNumAtlasedY]; |
| 285 | |
| 286 | for (int y = 0; y < kNumAtlasedY; ++y) { |
| 287 | for (int x = 0; x < kNumAtlasedX; ++x) { |
| 288 | colors[x][y] = rand.nextU() | 0xff000000; |
| 289 | fAtlasRects[x][y] = SkIRect::MakeXYWH(kAtlasSpacer + x * (kAtlasCellWidth + kAtlasSpacer), |
| 290 | kAtlasSpacer + y * (kAtlasCellHeight + kAtlasSpacer), |
| 291 | kAtlasCellWidth, |
| 292 | kAtlasCellHeight); |
| 293 | } |
| 294 | } |
| 295 | |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 296 | fAtlas.setConfig(SkBitmap::kARGB_8888_Config, kTotAtlasWidth, kTotAtlasHeight); |
| 297 | fAtlas.allocPixels(); |
| 298 | SkAutoLockPixels lock(fAtlas); |
| 299 | |
| 300 | for (int y = 0; y < kTotAtlasHeight; ++y) { |
| 301 | int colorY = y / (kAtlasCellHeight + kAtlasSpacer); |
| 302 | bool inColorY = (y % (kAtlasCellHeight + kAtlasSpacer)) >= kAtlasSpacer; |
| 303 | |
| 304 | SkPMColor* scanline = fAtlas.getAddr32(0, y); |
| 305 | |
| 306 | for (int x = 0; x < kTotAtlasWidth; ++x, ++scanline) { |
| 307 | int colorX = x / (kAtlasCellWidth + kAtlasSpacer); |
| 308 | bool inColorX = (x % (kAtlasCellWidth + kAtlasSpacer)) >= kAtlasSpacer; |
| 309 | |
| 310 | if (inColorX && inColorY) { |
| 311 | SkASSERT(colorX < kNumAtlasedX && colorY < kNumAtlasedY); |
| 312 | *scanline = colors[colorX][colorY]; |
| 313 | } else { |
| 314 | *scanline = 0x00000000; |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 320 | typedef SkBenchmark INHERITED; |
| 321 | }; |
| 322 | |
| 323 | // Partial clear |
skia.committer@gmail.com | 26da7f0 | 2013-06-01 07:01:39 +0000 | [diff] [blame] | 324 | DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kScale_Type, |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 325 | GameBench::kPartial_Clear)); ) |
skia.committer@gmail.com | 26da7f0 | 2013-06-01 07:01:39 +0000 | [diff] [blame] | 326 | DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 327 | GameBench::kPartial_Clear)); ) |
skia.committer@gmail.com | 26da7f0 | 2013-06-01 07:01:39 +0000 | [diff] [blame] | 328 | DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 329 | GameBench::kPartial_Clear, true)); ) |
skia.committer@gmail.com | 26da7f0 | 2013-06-01 07:01:39 +0000 | [diff] [blame] | 330 | DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kRotate_Type, |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 331 | GameBench::kPartial_Clear)); ) |
robertphillips@google.com | 6670ab9 | 2013-05-09 19:03:48 +0000 | [diff] [blame] | 332 | |
| 333 | // Full clear |
skia.committer@gmail.com | 26da7f0 | 2013-06-01 07:01:39 +0000 | [diff] [blame] | 334 | DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kScale_Type, |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 335 | GameBench::kFull_Clear)); ) |
skia.committer@gmail.com | 26da7f0 | 2013-06-01 07:01:39 +0000 | [diff] [blame] | 336 | DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 337 | GameBench::kFull_Clear)); ) |
skia.committer@gmail.com | 26da7f0 | 2013-06-01 07:01:39 +0000 | [diff] [blame] | 338 | DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 339 | GameBench::kFull_Clear, true)); ) |
skia.committer@gmail.com | 26da7f0 | 2013-06-01 07:01:39 +0000 | [diff] [blame] | 340 | DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kRotate_Type, |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 341 | GameBench::kFull_Clear)); ) |
| 342 | |
| 343 | // Atlased |
skia.committer@gmail.com | 26da7f0 | 2013-06-01 07:01:39 +0000 | [diff] [blame] | 344 | DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, |
robertphillips@google.com | f865be3 | 2013-05-31 13:27:02 +0000 | [diff] [blame] | 345 | GameBench::kFull_Clear, false, true)); ) |
robertphillips@google.com | 631a59b | 2013-07-31 14:57:53 +0000 | [diff] [blame] | 346 | DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, |
| 347 | GameBench::kFull_Clear, false, true, true)); ) |