Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: gm/bleed.cpp

Issue 1429863007: Add outer blur to bleed GM family (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 desc.fHeight = bitmap.height() + 23; 52 desc.fHeight = bitmap.height() + 23;
53 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de sc, true)); 53 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de sc, true));
54 if (!texture) { 54 if (!texture) {
55 return; 55 return;
56 } 56 }
57 // Init the whole texture to 0 in the alpha case or solid green in the 32bit rgba case. 57 // Init the whole texture to 0 in the alpha case or solid green in the 32bit rgba case.
58 SkAutoLockPixels al(bitmap); 58 SkAutoLockPixels al(bitmap);
59 if (kAlpha_8_GrPixelConfig == texture->config()) { 59 if (kAlpha_8_GrPixelConfig == texture->config()) {
60 SkAutoMalloc pixels(texture->width() * texture->height()); 60 SkAutoMalloc pixels(texture->width() * texture->height());
61 memset(pixels.get(), 0, texture->width() * texture->height()); 61 memset(pixels.get(), 0, texture->width() * texture->height());
62 texture->writePixels(0, 0, texture->width(), texture->height(), desc.fCo nfig, pixels.get(), 0); 62 texture->writePixels(0, 0, texture->width(), texture->height(), desc.fCo nfig, pixels.get(),
63 0);
63 } else { 64 } else {
64 SkAutoMalloc pixels(texture->width() * texture->height() * sizeof(uint32 _t)); 65 SkAutoMalloc pixels(texture->width() * texture->height() * sizeof(uint32 _t));
65 SkOpts::memset32((uint32_t*)pixels.get(), 0xFF00FF00, texture->width()*t exture->height()); 66 SkOpts::memset32((uint32_t*)pixels.get(), 0xFF00FF00, texture->width()*t exture->height());
66 texture->writePixels(0, 0, texture->width(), texture->height(), desc.fCo nfig, pixels.get(), 0); 67 texture->writePixels(0, 0, texture->width(), texture->height(), desc.fCo nfig, pixels.get(),
68 0);
67 } 69 }
68 70
69 // Upload the bitmap contents to the upper left. 71 // Upload the bitmap contents to the upper left.
70 texture->writePixels(0, 0, bitmap.width(), bitmap.height(), desc.fConfig, bi tmap.getPixels(), 72 texture->writePixels(0, 0, bitmap.width(), bitmap.height(), desc.fConfig, bi tmap.getPixels(),
71 bitmap.rowBytes()); 73 bitmap.rowBytes());
72 74
73 // Wrap the texture in a bitmap and draw it. 75 // Wrap the texture in a bitmap and draw it.
74 SkBitmap textureBmp; 76 SkBitmap textureBmp;
75 GrWrapTextureInBitmap(texture, bitmap.width(), bitmap.height(), true, &textu reBmp); 77 GrWrapTextureInBitmap(texture, bitmap.width(), bitmap.height(), true, &textu reBmp);
76 canvas->drawBitmapRect(textureBmp, src, dst, paint, constraint); 78 canvas->drawBitmapRect(textureBmp, src, dst, paint, constraint);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 public: 255 public:
254 BleedGM(BleedTest bt) : fBT(bt) {} 256 BleedGM(BleedTest bt) : fBT(bt) {}
255 257
256 protected: 258 protected:
257 259
258 SkString onShortName() override { 260 SkString onShortName() override {
259 return SkString(gBleedRec[fBT].fName); 261 return SkString(gBleedRec[fBT].fName);
260 } 262 }
261 263
262 SkISize onISize() override { 264 SkISize onISize() override {
263 return SkISize::Make(1050, 780); 265 return SkISize::Make(1200, 1080);
264 } 266 }
265 267
266 void onOnceBeforeDraw() override { 268 void onOnceBeforeDraw() override {
267 gBleedRec[fBT].fBmpMaker(&fBitmapSmall, kSmallTextureSize, kSmallTexture Size); 269 gBleedRec[fBT].fBmpMaker(&fBitmapSmall, kSmallTextureSize, kSmallTexture Size);
268 fImageSmall.reset(SkImage::NewFromBitmap(fBitmapSmall)); 270 fImageSmall.reset(SkImage::NewFromBitmap(fBitmapSmall));
269 271
270 // To exercise the GPU's tiling path we need a texture 272 // To exercise the GPU's tiling path we need a texture
271 // too big for the GPU to handle in one go 273 // too big for the GPU to handle in one go
272 gBleedRec[fBT].fBmpMaker(&fBitmapBig, 2*kMaxTileSize, 2*kMaxTileSize); 274 gBleedRec[fBT].fBmpMaker(&fBitmapBig, 2*kMaxTileSize, 2*kMaxTileSize);
273 fImageBig.reset(SkImage::NewFromBitmap(fBitmapBig)); 275 fImageBig.reset(SkImage::NewFromBitmap(fBitmapBig));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 324
323 SkPaint paint; 325 SkPaint paint;
324 paint.setFilterQuality(filter); 326 paint.setFilterQuality(filter);
325 paint.setShader(fShader); 327 paint.setShader(fShader);
326 paint.setColor(SK_ColorBLUE); 328 paint.setColor(SK_ColorBLUE);
327 paint.setAntiAlias(aa); 329 paint.setAntiAlias(aa);
328 330
329 gBleedRec[fBT].fDraw(canvas, fBitmapBig, fImageBig, src, dst, &paint, co nstraint); 331 gBleedRec[fBT].fDraw(canvas, fBitmapBig, fImageBig, src, dst, &paint, co nstraint);
330 } 332 }
331 333
332 // Draw the center of the small bitmap with a mask filter 334 // Draw the center of the small bitmap with a normal blur
333 void drawCase4(SkCanvas* canvas, int transX, int transY, bool aa, 335 void drawCase4(SkCanvas* canvas, int transX, int transY, bool aa,
334 SkCanvas::SrcRectConstraint constraint, SkFilterQuality filte r) { 336 SkCanvas::SrcRectConstraint constraint, SkFilterQuality filte r) {
335 SkRect src = SkRect::MakeXYWH(2, 2, 337 SkRect src = SkRect::MakeXYWH(2, 2,
336 SkIntToScalar(kSmallTextureSize-4), 338 SkIntToScalar(kSmallTextureSize-4),
337 SkIntToScalar(kSmallTextureSize-4)); 339 SkIntToScalar(kSmallTextureSize-4));
338 SkRect dst = SkRect::MakeXYWH(SkIntToScalar(transX), SkIntToScalar(trans Y), 340 SkRect dst = SkRect::MakeXYWH(SkIntToScalar(transX), SkIntToScalar(trans Y),
339 SkIntToScalar(kBlockSize), SkIntToScalar(k BlockSize)); 341 SkIntToScalar(kBlockSize), SkIntToScalar(k BlockSize));
340 342
341 SkPaint paint; 343 SkPaint paint;
342 paint.setFilterQuality(filter); 344 paint.setFilterQuality(filter);
343 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, 345 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
344 SkBlurMask::ConvertRadiusToSigma(3)); 346 SkBlurMask::ConvertRadiusToSigma(3));
345 paint.setMaskFilter(mf)->unref(); 347 paint.setMaskFilter(mf)->unref();
346 paint.setShader(fShader); 348 paint.setShader(fShader);
347 paint.setColor(SK_ColorBLUE); 349 paint.setColor(SK_ColorBLUE);
348 paint.setAntiAlias(aa); 350 paint.setAntiAlias(aa);
349 351
350 gBleedRec[fBT].fDraw(canvas, fBitmapSmall, fImageSmall, src, dst, &paint , constraint); 352 gBleedRec[fBT].fDraw(canvas, fBitmapSmall, fImageSmall, src, dst, &paint , constraint);
351 } 353 }
352 354
355 // Draw the center of the small bitmap with a outer blur
356 void drawCase5(SkCanvas* canvas, int transX, int transY, bool aa,
357 SkCanvas::SrcRectConstraint constraint, SkFilterQuality filte r) {
358 SkRect src = SkRect::MakeXYWH(2, 2,
359 SkIntToScalar(kSmallTextureSize - 4),
360 SkIntToScalar(kSmallTextureSize - 4));
361 SkRect dst = SkRect::MakeXYWH(SkIntToScalar(transX), SkIntToScalar(trans Y),
362 SkIntToScalar(kBlockSize), SkIntToScalar(k BlockSize));
363
364 SkPaint paint;
365 paint.setFilterQuality(filter);
366 SkMaskFilter* mf = SkBlurMaskFilter::Create(kOuter_SkBlurStyle,
367 SkBlurMask::ConvertRadiusToS igma(7));
368 paint.setMaskFilter(mf)->unref();
369 paint.setShader(fShader);
370 paint.setColor(SK_ColorBLUE);
371 paint.setAntiAlias(aa);
372
373 gBleedRec[fBT].fDraw(canvas, fBitmapSmall, fImageSmall, src, dst, &paint , constraint);
374 }
375
353 void onDraw(SkCanvas* canvas) override { 376 void onDraw(SkCanvas* canvas) override {
354 canvas->clear(SK_ColorGRAY); 377 canvas->clear(SK_ColorGRAY);
355 SkTDArray<SkMatrix> matrices; 378 SkTDArray<SkMatrix> matrices;
356 // Draw with identity 379 // Draw with identity
357 *matrices.append() = SkMatrix::I(); 380 *matrices.append() = SkMatrix::I();
358 381
359 // Draw with rotation and scale down in x, up in y. 382 // Draw with rotation and scale down in x, up in y.
360 SkMatrix m; 383 SkMatrix m;
361 static const SkScalar kBottom = SkIntToScalar(kRow3Y + kBlockSize + kBlo ckSpacing); 384 static const SkScalar kBottom = SkIntToScalar(kRow4Y + kBlockSize + kBlo ckSpacing);
362 m.setTranslate(0, kBottom); 385 m.setTranslate(0, kBottom);
363 m.preRotate(15.f, 0, kBottom + kBlockSpacing); 386 m.preRotate(15.f, 0, kBottom + kBlockSpacing);
364 m.preScale(0.71f, 1.22f); 387 m.preScale(0.71f, 1.22f);
365 *matrices.append() = m; 388 *matrices.append() = m;
366 389
367 // Align the next set with the middle of the previous in y, translated t o the right in x. 390 // Align the next set with the middle of the previous in y, translated t o the right in x.
368 SkPoint corners[] = {{0, 0}, { 0, kBottom }, { kWidth, kBottom }, {kWidt h, 0} }; 391 SkPoint corners[] = {{0, 0}, { 0, kBottom }, { kWidth, kBottom }, {kWidt h, 0} };
369 matrices[matrices.count()-1].mapPoints(corners, 4); 392 matrices[matrices.count()-1].mapPoints(corners, 4);
370 SkScalar y = (corners[0].fY + corners[1].fY + corners[2].fY + corners[3] .fY) / 4; 393 SkScalar y = (corners[0].fY + corners[1].fY + corners[2].fY + corners[3] .fY) / 4;
371 SkScalar x = SkTMax(SkTMax(corners[0].fX, corners[1].fX), 394 SkScalar x = SkTMax(SkTMax(corners[0].fX, corners[1].fX),
372 SkTMax(corners[2].fX, corners[3].fX)); 395 SkTMax(corners[2].fX, corners[3].fX));
373 m.setTranslate(x, y); 396 m.setTranslate(x, y);
374 m.preScale(0.2f, 0.2f); 397 m.preScale(0.2f, 0.2f);
375 *matrices.append() = m; 398 *matrices.append() = m;
376 399
377 SkScalar maxX = 0; 400 SkScalar maxX = 0;
378 for (int antiAlias = 0; antiAlias < 2; ++antiAlias) { 401 for (int antiAlias = 0; antiAlias < 2; ++antiAlias) {
379 canvas->save(); 402 canvas->save();
380 canvas->translate(maxX, 0); 403 canvas->translate(maxX, 0);
381 for (int m = 0; m < matrices.count(); ++m) { 404 for (int m = 0; m < matrices.count(); ++m) {
382 canvas->save(); 405 canvas->save();
383 canvas->concat(matrices[m]); 406 canvas->concat(matrices[m]);
384 bool aa = SkToBool(antiAlias); 407 bool aa = SkToBool(antiAlias);
385 408
386 // First draw a column with no bleeding and no filtering 409 // First draw a column with no bleeding and no filtering
387 this->drawCase1(canvas, kCol0X, kRow0Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kNone_SkFilterQuality); 410 this->drawCase1(canvas, kCol0X, kRow0Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kNone_SkFilterQuality);
388 this->drawCase2(canvas, kCol0X, kRow1Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kNone_SkFilterQuality); 411 this->drawCase2(canvas, kCol0X, kRow1Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kNone_SkFilterQuality);
389 this->drawCase3(canvas, kCol0X, kRow2Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kNone_SkFilterQuality); 412 this->drawCase3(canvas, kCol0X, kRow2Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kNone_SkFilterQuality);
390 this->drawCase4(canvas, kCol0X, kRow3Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kNone_SkFilterQuality); 413 this->drawCase4(canvas, kCol0X, kRow3Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kNone_SkFilterQuality);
414 this->drawCase5(canvas, kCol0X, kRow4Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kNone_SkFilterQuality);
391 415
392 // Then draw a column with no bleeding and low filtering 416 // Then draw a column with no bleeding and low filtering
393 this->drawCase1(canvas, kCol1X, kRow0Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kLow_SkFilterQuality); 417 this->drawCase1(canvas, kCol1X, kRow0Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kLow_SkFilterQuality);
394 this->drawCase2(canvas, kCol1X, kRow1Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kLow_SkFilterQuality); 418 this->drawCase2(canvas, kCol1X, kRow1Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kLow_SkFilterQuality);
395 this->drawCase3(canvas, kCol1X, kRow2Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kLow_SkFilterQuality); 419 this->drawCase3(canvas, kCol1X, kRow2Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kLow_SkFilterQuality);
396 this->drawCase4(canvas, kCol1X, kRow3Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kLow_SkFilterQuality); 420 this->drawCase4(canvas, kCol1X, kRow3Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kLow_SkFilterQuality);
421 this->drawCase5(canvas, kCol1X, kRow4Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kLow_SkFilterQuality);
397 422
398 // Then draw a column with no bleeding and high filtering 423 // Then draw a column with no bleeding and high filtering
399 this->drawCase1(canvas, kCol2X, kRow0Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kHigh_SkFilterQuality); 424 this->drawCase1(canvas, kCol2X, kRow0Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kHigh_SkFilterQuality);
400 this->drawCase2(canvas, kCol2X, kRow1Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kHigh_SkFilterQuality); 425 this->drawCase2(canvas, kCol2X, kRow1Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kHigh_SkFilterQuality);
401 this->drawCase3(canvas, kCol2X, kRow2Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kHigh_SkFilterQuality); 426 this->drawCase3(canvas, kCol2X, kRow2Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kHigh_SkFilterQuality);
402 this->drawCase4(canvas, kCol2X, kRow3Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kHigh_SkFilterQuality); 427 this->drawCase4(canvas, kCol2X, kRow3Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kHigh_SkFilterQuality);
428 this->drawCase5(canvas, kCol2X, kRow4Y, aa, SkCanvas::kStrict_Sr cRectConstraint, kHigh_SkFilterQuality);
403 429
404 // Then draw a column with bleeding and no filtering (bleed shou ld have no effect w/out blur) 430 // Then draw a column with bleeding and no filtering (bleed shou ld have no effect w/out blur)
405 this->drawCase1(canvas, kCol3X, kRow0Y, aa, SkCanvas::kFast_SrcR ectConstraint, kNone_SkFilterQuality); 431 this->drawCase1(canvas, kCol3X, kRow0Y, aa, SkCanvas::kFast_SrcR ectConstraint, kNone_SkFilterQuality);
406 this->drawCase2(canvas, kCol3X, kRow1Y, aa, SkCanvas::kFast_SrcR ectConstraint, kNone_SkFilterQuality); 432 this->drawCase2(canvas, kCol3X, kRow1Y, aa, SkCanvas::kFast_SrcR ectConstraint, kNone_SkFilterQuality);
407 this->drawCase3(canvas, kCol3X, kRow2Y, aa, SkCanvas::kFast_SrcR ectConstraint, kNone_SkFilterQuality); 433 this->drawCase3(canvas, kCol3X, kRow2Y, aa, SkCanvas::kFast_SrcR ectConstraint, kNone_SkFilterQuality);
408 this->drawCase4(canvas, kCol3X, kRow3Y, aa, SkCanvas::kFast_SrcR ectConstraint, kNone_SkFilterQuality); 434 this->drawCase4(canvas, kCol3X, kRow3Y, aa, SkCanvas::kFast_SrcR ectConstraint, kNone_SkFilterQuality);
435 this->drawCase5(canvas, kCol3X, kRow4Y, aa, SkCanvas::kFast_SrcR ectConstraint, kNone_SkFilterQuality);
409 436
410 // Then draw a column with bleeding and low filtering 437 // Then draw a column with bleeding and low filtering
411 this->drawCase1(canvas, kCol4X, kRow0Y, aa, SkCanvas::kFast_SrcR ectConstraint, kLow_SkFilterQuality); 438 this->drawCase1(canvas, kCol4X, kRow0Y, aa, SkCanvas::kFast_SrcR ectConstraint, kLow_SkFilterQuality);
412 this->drawCase2(canvas, kCol4X, kRow1Y, aa, SkCanvas::kFast_SrcR ectConstraint, kLow_SkFilterQuality); 439 this->drawCase2(canvas, kCol4X, kRow1Y, aa, SkCanvas::kFast_SrcR ectConstraint, kLow_SkFilterQuality);
413 this->drawCase3(canvas, kCol4X, kRow2Y, aa, SkCanvas::kFast_SrcR ectConstraint, kLow_SkFilterQuality); 440 this->drawCase3(canvas, kCol4X, kRow2Y, aa, SkCanvas::kFast_SrcR ectConstraint, kLow_SkFilterQuality);
414 this->drawCase4(canvas, kCol4X, kRow3Y, aa, SkCanvas::kFast_SrcR ectConstraint, kLow_SkFilterQuality); 441 this->drawCase4(canvas, kCol4X, kRow3Y, aa, SkCanvas::kFast_SrcR ectConstraint, kLow_SkFilterQuality);
442 this->drawCase5(canvas, kCol4X, kRow4Y, aa, SkCanvas::kFast_SrcR ectConstraint, kLow_SkFilterQuality);
415 443
416 // Finally draw a column with bleeding and high filtering 444 // Finally draw a column with bleeding and high filtering
417 this->drawCase1(canvas, kCol5X, kRow0Y, aa, SkCanvas::kFast_SrcR ectConstraint, kHigh_SkFilterQuality); 445 this->drawCase1(canvas, kCol5X, kRow0Y, aa, SkCanvas::kFast_SrcR ectConstraint, kHigh_SkFilterQuality);
418 this->drawCase2(canvas, kCol5X, kRow1Y, aa, SkCanvas::kFast_SrcR ectConstraint, kHigh_SkFilterQuality); 446 this->drawCase2(canvas, kCol5X, kRow1Y, aa, SkCanvas::kFast_SrcR ectConstraint, kHigh_SkFilterQuality);
419 this->drawCase3(canvas, kCol5X, kRow2Y, aa, SkCanvas::kFast_SrcR ectConstraint, kHigh_SkFilterQuality); 447 this->drawCase3(canvas, kCol5X, kRow2Y, aa, SkCanvas::kFast_SrcR ectConstraint, kHigh_SkFilterQuality);
420 this->drawCase4(canvas, kCol5X, kRow3Y, aa, SkCanvas::kFast_SrcR ectConstraint, kHigh_SkFilterQuality); 448 this->drawCase4(canvas, kCol5X, kRow3Y, aa, SkCanvas::kFast_SrcR ectConstraint, kHigh_SkFilterQuality);
449 this->drawCase5(canvas, kCol5X, kRow4Y, aa, SkCanvas::kFast_SrcR ectConstraint, kHigh_SkFilterQuality);
421 450
422 SkPoint corners[] = { { 0, 0 },{ 0, kBottom },{ kWidth, kBottom },{ kWidth, 0 } }; 451 SkPoint corners[] = { { 0, 0 },{ 0, kBottom },{ kWidth, kBottom },{ kWidth, 0 } };
423 matrices[m].mapPoints(corners, 4); 452 matrices[m].mapPoints(corners, 4);
424 SkScalar x = kBlockSize + SkTMax(SkTMax(corners[0].fX, corners[1 ].fX), 453 SkScalar x = kBlockSize + SkTMax(SkTMax(corners[0].fX, corners[1 ].fX),
425 SkTMax(corners[2].fX, corners[3 ].fX)); 454 SkTMax(corners[2].fX, corners[3 ].fX));
426 maxX = SkTMax(maxX, x); 455 maxX = SkTMax(maxX, x);
427 canvas->restore(); 456 canvas->restore();
428 } 457 }
429 canvas->restore(); 458 canvas->restore();
430 } 459 }
431 } 460 }
432 461
433 #if SK_SUPPORT_GPU 462 #if SK_SUPPORT_GPU
434 void modifyGrContextOptions(GrContextOptions* options) override { 463 void modifyGrContextOptions(GrContextOptions* options) override {
435 options->fMaxTileSizeOverride = kMaxTileSize; 464 options->fMaxTileSizeOverride = kMaxTileSize;
436 } 465 }
437 #endif 466 #endif
438 467
439 private: 468 private:
440 static const int kBlockSize = 70; 469 static const int kBlockSize = 70;
441 static const int kBlockSpacing = 5; 470 static const int kBlockSpacing = 12;
442 471
443 static const int kCol0X = kBlockSpacing; 472 static const int kCol0X = kBlockSpacing;
444 static const int kCol1X = 2*kBlockSpacing + kBlockSize; 473 static const int kCol1X = 2*kBlockSpacing + kBlockSize;
445 static const int kCol2X = 3*kBlockSpacing + 2*kBlockSize; 474 static const int kCol2X = 3*kBlockSpacing + 2*kBlockSize;
446 static const int kCol3X = 4*kBlockSpacing + 3*kBlockSize; 475 static const int kCol3X = 4*kBlockSpacing + 3*kBlockSize;
447 static const int kCol4X = 5*kBlockSpacing + 4*kBlockSize; 476 static const int kCol4X = 5*kBlockSpacing + 4*kBlockSize;
448 static const int kCol5X = 6*kBlockSpacing + 5*kBlockSize; 477 static const int kCol5X = 6*kBlockSpacing + 5*kBlockSize;
449 static const int kWidth = 7*kBlockSpacing + 6*kBlockSize; 478 static const int kWidth = 7*kBlockSpacing + 6*kBlockSize;
450 479
451 static const int kRow0Y = kBlockSpacing; 480 static const int kRow0Y = kBlockSpacing;
452 static const int kRow1Y = 2*kBlockSpacing + kBlockSize; 481 static const int kRow1Y = 2*kBlockSpacing + kBlockSize;
453 static const int kRow2Y = 3*kBlockSpacing + 2*kBlockSize; 482 static const int kRow2Y = 3*kBlockSpacing + 2*kBlockSize;
454 static const int kRow3Y = 4*kBlockSpacing + 3*kBlockSize; 483 static const int kRow3Y = 4*kBlockSpacing + 3*kBlockSize;
484 static const int kRow4Y = 5*kBlockSpacing + 4*kBlockSize;
455 485
456 static const int kSmallTextureSize = 6; 486 static const int kSmallTextureSize = 6;
457 static const int kMaxTileSize = 32; 487 static const int kMaxTileSize = 32;
458 488
459 SkBitmap fBitmapSmall; 489 SkBitmap fBitmapSmall;
460 SkBitmap fBitmapBig; 490 SkBitmap fBitmapBig;
461 SkAutoTUnref<SkImage> fImageSmall; 491 SkAutoTUnref<SkImage> fImageSmall;
462 SkAutoTUnref<SkImage> fImageBig; 492 SkAutoTUnref<SkImage> fImageBig;
463 493
464 SkAutoTUnref<SkShader> fShader; 494 SkAutoTUnref<SkShader> fShader;
465 495
466 const BleedTest fBT; 496 const BleedTest fBT;
467 497
468 typedef GM INHERITED; 498 typedef GM INHERITED;
469 }; 499 };
470 500
471 501
472 DEF_GM( return new BleedGM(kUseBitmap_BleedTest); ) 502 DEF_GM( return new BleedGM(kUseBitmap_BleedTest); )
473 DEF_GM( return new BleedGM(kUseTextureBitmap_BleedTest); ) 503 DEF_GM( return new BleedGM(kUseTextureBitmap_BleedTest); )
474 DEF_GM( return new BleedGM(kUseImage_BleedTest); ) 504 DEF_GM( return new BleedGM(kUseImage_BleedTest); )
475 DEF_GM( return new BleedGM(kUseAlphaBitmap_BleedTest); ) 505 DEF_GM( return new BleedGM(kUseAlphaBitmap_BleedTest); )
476 DEF_GM( return new BleedGM(kUseAlphaTextureBitmap_BleedTest); ) 506 DEF_GM( return new BleedGM(kUseAlphaTextureBitmap_BleedTest); )
477 DEF_GM( return new BleedGM(kUseAlphaImage_BleedTest); ) 507 DEF_GM( return new BleedGM(kUseAlphaImage_BleedTest); )
478 DEF_GM( return new BleedGM(kUseAlphaBitmapShader_BleedTest); ) 508 DEF_GM( return new BleedGM(kUseAlphaBitmapShader_BleedTest); )
479 DEF_GM( return new BleedGM(kUseAlphaTextureBitmapShader_BleedTest); ) 509 DEF_GM( return new BleedGM(kUseAlphaTextureBitmapShader_BleedTest); )
480 DEF_GM( return new BleedGM(kUseAlphaImageShader_BleedTest); ) 510 DEF_GM( return new BleedGM(kUseAlphaImageShader_BleedTest); )
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698