| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4)); | 76 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4)); |
| 77 return SkGradientShader::MakeTwoPointConical(center1, (pts[1].fX - pts[0].fX
) / 7, | 77 return SkGradientShader::MakeTwoPointConical(center1, (pts[1].fX - pts[0].fX
) / 7, |
| 78 center0, (pts[1].fX - pts[0].fX
) / 2, | 78 center0, (pts[1].fX - pts[0].fX
) / 2, |
| 79 colors, pos, SK_ARRAY_COUNT(col
ors), tm, | 79 colors, pos, SK_ARRAY_COUNT(col
ors), tm, |
| 80 0, &scale); | 80 0, &scale); |
| 81 } | 81 } |
| 82 | 82 |
| 83 typedef void (*PaintProc)(SkPaint*, SkScalar width); | 83 typedef void (*PaintProc)(SkPaint*, SkScalar width); |
| 84 | 84 |
| 85 class BlurRectGM : public skiagm::GM { | 85 class BlurRectGM : public skiagm::GM { |
| 86 SkAutoTUnref<SkMaskFilter> fMaskFilters[kLastEnum_SkBlurStyle + 1]; | 86 sk_sp<SkMaskFilter> fMaskFilters[kLastEnum_SkBlurStyle + 1]; |
| 87 SkString fName; | 87 SkString fName; |
| 88 SkAlpha fAlpha; | 88 SkAlpha fAlpha; |
| 89 public: | 89 public: |
| 90 BlurRectGM(const char name[], U8CPU alpha) | 90 BlurRectGM(const char name[], U8CPU alpha) |
| 91 : fName(name) | 91 : fName(name) |
| 92 , fAlpha(SkToU8(alpha)) { | 92 , fAlpha(SkToU8(alpha)) { |
| 93 } | 93 } |
| 94 | 94 |
| 95 protected: | 95 protected: |
| 96 void onOnceBeforeDraw() override { | 96 void onOnceBeforeDraw() override { |
| 97 for (int i = 0; i <= kLastEnum_SkBlurStyle; ++i) { | 97 for (int i = 0; i <= kLastEnum_SkBlurStyle; ++i) { |
| 98 fMaskFilters[i].reset(SkBlurMaskFilter::Create((SkBlurStyle)i, | 98 fMaskFilters[i] = SkBlurMaskFilter::Make((SkBlurStyle)i, |
| 99 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar
(STROKE_WIDTH/2)), | 99 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar
(STROKE_WIDTH/2)), |
| 100 SkBlurMaskFilter::kHighQuality_BlurFlag)); | 100 SkBlurMaskFilter::kHighQuality_BlurFlag); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 SkString onShortName() override { | 104 SkString onShortName() override { |
| 105 return fName; | 105 return fName; |
| 106 } | 106 } |
| 107 | 107 |
| 108 SkISize onISize() override { | 108 SkISize onISize() override { |
| 109 return SkISize::Make(860, 820); | 109 return SkISize::Make(860, 820); |
| 110 } | 110 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 if (bm.height() > max_height) | 225 if (bm.height() > max_height) |
| 226 max_height = bm.height(); | 226 max_height = bm.height(); |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 ////////////////////////////////////////////////////////////////////////////// | 232 ////////////////////////////////////////////////////////////////////////////// |
| 233 | 233 |
| 234 DEF_GM(return new BlurRectGM("blurrects", 0xFF);) | 234 DEF_GM(return new BlurRectGM("blurrects", 0xFF);) |
| OLD | NEW |