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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 const SkRect& circle() const { return fCircle; } | 42 const SkRect& circle() const { return fCircle; } |
43 float sigma() const { return fSigma; } | 43 float sigma() const { return fSigma; } |
44 float offset() const { return fOffset; } | 44 float offset() const { return fOffset; } |
45 int profileSize() const { return fBlurProfileAccess.getTexture()->width(); } | 45 int profileSize() const { return fBlurProfileAccess.getTexture()->width(); } |
46 | 46 |
47 private: | 47 private: |
48 GrCircleBlurFragmentProcessor(const SkRect& circle, float sigma, | 48 GrCircleBlurFragmentProcessor(const SkRect& circle, float sigma, |
49 float offset, GrTexture* blurProfile); | 49 float offset, GrTexture* blurProfile); |
50 | 50 |
51 GrGLSLFragmentProcessor* onCreateGLInstance() const override; | 51 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
52 | 52 |
53 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override; | 53 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b)
const override; |
54 | 54 |
55 bool onIsEqual(const GrFragmentProcessor& other) const override { | 55 bool onIsEqual(const GrFragmentProcessor& other) const override { |
56 const GrCircleBlurFragmentProcessor& cbfp = other.cast<GrCircleBlurFragm
entProcessor>(); | 56 const GrCircleBlurFragmentProcessor& cbfp = other.cast<GrCircleBlurFragm
entProcessor>(); |
57 // fOffset is computed from the circle width and the sigma | 57 // fOffset is computed from the circle width and the sigma |
58 return this->circle().width() == cbfp.circle().width() && fSigma == cbfp
.fSigma; | 58 return this->circle().width() == cbfp.circle().width() && fSigma == cbfp
.fSigma; |
59 } | 59 } |
60 | 60 |
61 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 61 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
62 | 62 |
63 static GrTexture* CreateCircleBlurProfileTexture(GrTextureProvider*, | 63 static GrTexture* CreateCircleBlurProfileTexture(GrTextureProvider*, |
64 const SkRect& circle, | 64 const SkRect& circle, |
65 float sigma, float* offset)
; | 65 float sigma, float* offset)
; |
66 | 66 |
67 SkRect fCircle; | 67 SkRect fCircle; |
68 float fSigma; | 68 float fSigma; |
69 float fOffset; | 69 float fOffset; |
70 GrTextureAccess fBlurProfileAccess; | 70 GrTextureAccess fBlurProfileAccess; |
71 | 71 |
72 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 72 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
73 | 73 |
74 typedef GrFragmentProcessor INHERITED; | 74 typedef GrFragmentProcessor INHERITED; |
75 }; | 75 }; |
76 | 76 |
77 #endif | 77 #endif |
78 #endif | 78 #endif |
OLD | NEW |