| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #ifndef GrCircleBlurFragmentProcessor_DEFINED | 8 #ifndef GrCircleBlurFragmentProcessor_DEFINED |
| 9 #define GrCircleBlurFragmentProcessor_DEFINED | 9 #define GrCircleBlurFragmentProcessor_DEFINED |
| 10 | 10 |
| 11 #include "SkString.h" |
| 11 #include "SkTypes.h" | 12 #include "SkTypes.h" |
| 12 | 13 |
| 13 #if SK_SUPPORT_GPU | 14 #if SK_SUPPORT_GPU |
| 14 | 15 |
| 15 #include "GrFragmentProcessor.h" | 16 #include "GrFragmentProcessor.h" |
| 16 #include "GrProcessorUnitTest.h" | 17 #include "GrProcessorUnitTest.h" |
| 17 | 18 |
| 18 class GrTextureProvider; | 19 class GrTextureProvider; |
| 19 | 20 |
| 20 // This FP handles the special case of a blurred circle. It uses a 1D | 21 // This FP handles the special case of a blurred circle. It uses a 1D |
| 21 // profile that is just rotated about the origin of the circle. | 22 // profile that is just rotated about the origin of the circle. |
| 22 class GrCircleBlurFragmentProcessor : public GrFragmentProcessor { | 23 class GrCircleBlurFragmentProcessor : public GrFragmentProcessor { |
| 23 public: | 24 public: |
| 24 ~GrCircleBlurFragmentProcessor() override {}; | 25 ~GrCircleBlurFragmentProcessor() override {}; |
| 25 | 26 |
| 26 const char* name() const override { return "CircleBlur"; } | 27 const char* name() const override { return "CircleBlur"; } |
| 27 | 28 |
| 29 SkString dumpInfo() const override { |
| 30 SkString str; |
| 31 str.appendf("Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f], Sigma %.2f, Offs
et: %.2f", |
| 32 fCircle.fLeft, fCircle.fTop, fCircle.fRight, fCircle.fBottom
, |
| 33 fSigma, fOffset); |
| 34 return str; |
| 35 } |
| 36 |
| 28 static const GrFragmentProcessor* Create(GrTextureProvider*textureProvider, | 37 static const GrFragmentProcessor* Create(GrTextureProvider*textureProvider, |
| 29 const SkRect& circle, float sigma)
{ | 38 const SkRect& circle, float sigma)
{ |
| 30 float offset; | 39 float offset; |
| 31 | 40 |
| 32 SkAutoTUnref<GrTexture> blurProfile(CreateCircleBlurProfileTexture(textu
reProvider, | 41 SkAutoTUnref<GrTexture> blurProfile(CreateCircleBlurProfileTexture(textu
reProvider, |
| 33 circl
e, | 42 circl
e, |
| 34 sigma
, | 43 sigma
, |
| 35 &offs
et)); | 44 &offs
et)); |
| 36 if (!blurProfile) { | 45 if (!blurProfile) { |
| 37 return nullptr; | 46 return nullptr; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 float fOffset; | 78 float fOffset; |
| 70 GrTextureAccess fBlurProfileAccess; | 79 GrTextureAccess fBlurProfileAccess; |
| 71 | 80 |
| 72 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 81 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 73 | 82 |
| 74 typedef GrFragmentProcessor INHERITED; | 83 typedef GrFragmentProcessor INHERITED; |
| 75 }; | 84 }; |
| 76 | 85 |
| 77 #endif | 86 #endif |
| 78 #endif | 87 #endif |
| OLD | NEW |