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 |
(...skipping 16 matching lines...) Expand all Loading... |
27 const char* name() const override { return "CircleBlur"; } | 27 const char* name() const override { return "CircleBlur"; } |
28 | 28 |
29 SkString dumpInfo() const override { | 29 SkString dumpInfo() const override { |
30 SkString str; | 30 SkString str; |
31 str.appendf("Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f], Sigma %.2f, Offs
et: %.2f", | 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
, | 32 fCircle.fLeft, fCircle.fTop, fCircle.fRight, fCircle.fBottom
, |
33 fSigma, fOffset); | 33 fSigma, fOffset); |
34 return str; | 34 return str; |
35 } | 35 } |
36 | 36 |
37 static const GrFragmentProcessor* Create(GrTextureProvider*textureProvider, | 37 static sk_sp<GrFragmentProcessor> Make(GrTextureProvider*textureProvider, |
38 const SkRect& circle, float sigma)
{ | 38 const SkRect& circle, float sigma) { |
39 float offset; | 39 float offset; |
40 | 40 |
41 SkAutoTUnref<GrTexture> blurProfile(CreateCircleBlurProfileTexture(textu
reProvider, | 41 SkAutoTUnref<GrTexture> blurProfile(CreateCircleBlurProfileTexture(textu
reProvider, |
42 circl
e, | 42 circl
e, |
43 sigma
, | 43 sigma
, |
44 &offs
et)); | 44 &offs
et)); |
45 if (!blurProfile) { | 45 if (!blurProfile) { |
46 return nullptr; | 46 return nullptr; |
47 } | 47 } |
48 return new GrCircleBlurFragmentProcessor(circle, sigma, offset, blurProf
ile); | 48 return sk_sp<GrFragmentProcessor>( |
| 49 new GrCircleBlurFragmentProcessor(circle, sigma, offset, blurProfile
)); |
49 } | 50 } |
50 | 51 |
51 const SkRect& circle() const { return fCircle; } | 52 const SkRect& circle() const { return fCircle; } |
52 float sigma() const { return fSigma; } | 53 float sigma() const { return fSigma; } |
53 float offset() const { return fOffset; } | 54 float offset() const { return fOffset; } |
54 int profileSize() const { return fBlurProfileAccess.getTexture()->width(); } | 55 int profileSize() const { return fBlurProfileAccess.getTexture()->width(); } |
55 | 56 |
56 private: | 57 private: |
57 GrCircleBlurFragmentProcessor(const SkRect& circle, float sigma, | 58 GrCircleBlurFragmentProcessor(const SkRect& circle, float sigma, |
58 float offset, GrTexture* blurProfile); | 59 float offset, GrTexture* blurProfile); |
(...skipping 19 matching lines...) Expand all Loading... |
78 float fOffset; | 79 float fOffset; |
79 GrTextureAccess fBlurProfileAccess; | 80 GrTextureAccess fBlurProfileAccess; |
80 | 81 |
81 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 82 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
82 | 83 |
83 typedef GrFragmentProcessor INHERITED; | 84 typedef GrFragmentProcessor INHERITED; |
84 }; | 85 }; |
85 | 86 |
86 #endif | 87 #endif |
87 #endif | 88 #endif |
OLD | NEW |