| OLD | NEW |
| 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 403 |
| 404 // Draw the area of interest of the small image with a normal blur | 404 // Draw the area of interest of the small image with a normal blur |
| 405 void drawCase4(SkCanvas* canvas, int transX, int transY, bool aa, | 405 void drawCase4(SkCanvas* canvas, int transX, int transY, bool aa, |
| 406 SkCanvas::SrcRectConstraint constraint, SkFilterQuality filte
r) { | 406 SkCanvas::SrcRectConstraint constraint, SkFilterQuality filte
r) { |
| 407 SkRect src = SkRect::Make(fSmallTestPixels.fRect); | 407 SkRect src = SkRect::Make(fSmallTestPixels.fRect); |
| 408 SkRect dst = SkRect::MakeXYWH(SkIntToScalar(transX), SkIntToScalar(trans
Y), | 408 SkRect dst = SkRect::MakeXYWH(SkIntToScalar(transX), SkIntToScalar(trans
Y), |
| 409 SkIntToScalar(kBlockSize), SkIntToScalar(k
BlockSize)); | 409 SkIntToScalar(kBlockSize), SkIntToScalar(k
BlockSize)); |
| 410 | 410 |
| 411 SkPaint paint; | 411 SkPaint paint; |
| 412 paint.setFilterQuality(filter); | 412 paint.setFilterQuality(filter); |
| 413 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, | 413 paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, |
| 414 SkBlurMask::ConvertRadiusToSigma(3)); | 414 SkBlurMask::ConvertRadiusToSi
gma(3))); |
| 415 paint.setMaskFilter(mf)->unref(); | |
| 416 paint.setShader(fShader); | 415 paint.setShader(fShader); |
| 417 paint.setColor(SK_ColorBLUE); | 416 paint.setColor(SK_ColorBLUE); |
| 418 paint.setAntiAlias(aa); | 417 paint.setAntiAlias(aa); |
| 419 | 418 |
| 420 this->drawPixels(canvas, fSmallTestPixels, src, dst, &paint, constraint)
; | 419 this->drawPixels(canvas, fSmallTestPixels, src, dst, &paint, constraint)
; |
| 421 } | 420 } |
| 422 | 421 |
| 423 // Draw the area of interest of the small image with a outer blur | 422 // Draw the area of interest of the small image with a outer blur |
| 424 void drawCase5(SkCanvas* canvas, int transX, int transY, bool aa, | 423 void drawCase5(SkCanvas* canvas, int transX, int transY, bool aa, |
| 425 SkCanvas::SrcRectConstraint constraint, SkFilterQuality filte
r) { | 424 SkCanvas::SrcRectConstraint constraint, SkFilterQuality filte
r) { |
| 426 SkRect src = SkRect::Make(fSmallTestPixels.fRect); | 425 SkRect src = SkRect::Make(fSmallTestPixels.fRect); |
| 427 SkRect dst = SkRect::MakeXYWH(SkIntToScalar(transX), SkIntToScalar(trans
Y), | 426 SkRect dst = SkRect::MakeXYWH(SkIntToScalar(transX), SkIntToScalar(trans
Y), |
| 428 SkIntToScalar(kBlockSize), SkIntToScalar(k
BlockSize)); | 427 SkIntToScalar(kBlockSize), SkIntToScalar(k
BlockSize)); |
| 429 | 428 |
| 430 SkPaint paint; | 429 SkPaint paint; |
| 431 paint.setFilterQuality(filter); | 430 paint.setFilterQuality(filter); |
| 432 SkMaskFilter* mf = SkBlurMaskFilter::Create(kOuter_SkBlurStyle, | 431 paint.setMaskFilter(SkBlurMaskFilter::Make(kOuter_SkBlurStyle, |
| 433 SkBlurMask::ConvertRadiusToS
igma(7)); | 432 SkBlurMask::ConvertRadiusToSi
gma(7))); |
| 434 paint.setMaskFilter(mf)->unref(); | |
| 435 paint.setShader(fShader); | 433 paint.setShader(fShader); |
| 436 paint.setColor(SK_ColorBLUE); | 434 paint.setColor(SK_ColorBLUE); |
| 437 paint.setAntiAlias(aa); | 435 paint.setAntiAlias(aa); |
| 438 | 436 |
| 439 this->drawPixels(canvas, fSmallTestPixels, src, dst, &paint, constraint)
; | 437 this->drawPixels(canvas, fSmallTestPixels, src, dst, &paint, constraint)
; |
| 440 } | 438 } |
| 441 | 439 |
| 442 void onDraw(SkCanvas* canvas) override { | 440 void onDraw(SkCanvas* canvas) override { |
| 443 // We don't create pixels in an onOnceBeforeDraw() override because we w
ant access to | 441 // We don't create pixels in an onOnceBeforeDraw() override because we w
ant access to |
| 444 // GrContext. | 442 // GrContext. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 | 594 |
| 597 DEF_GM( return new BleedGM(kUseBitmap_BleedTest); ) | 595 DEF_GM( return new BleedGM(kUseBitmap_BleedTest); ) |
| 598 DEF_GM( return new BleedGM(kUseTextureBitmap_BleedTest); ) | 596 DEF_GM( return new BleedGM(kUseTextureBitmap_BleedTest); ) |
| 599 DEF_GM( return new BleedGM(kUseImage_BleedTest); ) | 597 DEF_GM( return new BleedGM(kUseImage_BleedTest); ) |
| 600 DEF_GM( return new BleedGM(kUseAlphaBitmap_BleedTest); ) | 598 DEF_GM( return new BleedGM(kUseAlphaBitmap_BleedTest); ) |
| 601 DEF_GM( return new BleedGM(kUseAlphaTextureBitmap_BleedTest); ) | 599 DEF_GM( return new BleedGM(kUseAlphaTextureBitmap_BleedTest); ) |
| 602 DEF_GM( return new BleedGM(kUseAlphaImage_BleedTest); ) | 600 DEF_GM( return new BleedGM(kUseAlphaImage_BleedTest); ) |
| 603 DEF_GM( return new BleedGM(kUseAlphaBitmapShader_BleedTest); ) | 601 DEF_GM( return new BleedGM(kUseAlphaBitmapShader_BleedTest); ) |
| 604 DEF_GM( return new BleedGM(kUseAlphaTextureBitmapShader_BleedTest); ) | 602 DEF_GM( return new BleedGM(kUseAlphaTextureBitmapShader_BleedTest); ) |
| 605 DEF_GM( return new BleedGM(kUseAlphaImageShader_BleedTest); ) | 603 DEF_GM( return new BleedGM(kUseAlphaImageShader_BleedTest); ) |
| OLD | NEW |