OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrCircleBlurFragmentProcessor.h" | 9 #include "GrCircleBlurFragmentProcessor.h" |
10 | 10 |
11 #if SK_SUPPORT_GPU | 11 #if SK_SUPPORT_GPU |
12 | 12 |
13 #include "GrContext.h" | 13 #include "GrContext.h" |
14 #include "GrInvariantOutput.h" | 14 #include "GrInvariantOutput.h" |
15 #include "GrTextureProvider.h" | 15 #include "GrTextureProvider.h" |
16 | 16 |
17 #include "glsl/GrGLSLFragmentProcessor.h" | 17 #include "glsl/GrGLSLFragmentProcessor.h" |
18 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 18 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
19 #include "glsl/GrGLSLProgramDataManager.h" | 19 #include "glsl/GrGLSLProgramDataManager.h" |
20 #include "glsl/GrGLSLUniformHandler.h" | 20 #include "glsl/GrGLSLUniformHandler.h" |
21 | 21 |
22 class GrGLCircleBlurFragmentProcessor : public GrGLSLFragmentProcessor { | 22 class GrGLCircleBlurFragmentProcessor : public GrGLSLFragmentProcessor { |
23 public: | 23 public: |
24 GrGLCircleBlurFragmentProcessor(const GrProcessor&) {} | |
25 void emitCode(EmitArgs&) override; | 24 void emitCode(EmitArgs&) override; |
26 | 25 |
27 protected: | 26 protected: |
28 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; | 27 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; |
29 | 28 |
30 private: | 29 private: |
31 GrGLSLProgramDataManager::UniformHandle fDataUniform; | 30 GrGLSLProgramDataManager::UniformHandle fDataUniform; |
32 | 31 |
33 typedef GrGLSLFragmentProcessor INHERITED; | 32 typedef GrGLSLFragmentProcessor INHERITED; |
34 }; | 33 }; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 : fCircle(circle) | 92 : fCircle(circle) |
94 , fSigma(sigma) | 93 , fSigma(sigma) |
95 , fOffset(offset) | 94 , fOffset(offset) |
96 , fBlurProfileAccess(blurProfile, GrTextureParams::kBilerp_FilterMode) { | 95 , fBlurProfileAccess(blurProfile, GrTextureParams::kBilerp_FilterMode) { |
97 this->initClassID<GrCircleBlurFragmentProcessor>(); | 96 this->initClassID<GrCircleBlurFragmentProcessor>(); |
98 this->addTextureAccess(&fBlurProfileAccess); | 97 this->addTextureAccess(&fBlurProfileAccess); |
99 this->setWillReadFragmentPosition(); | 98 this->setWillReadFragmentPosition(); |
100 } | 99 } |
101 | 100 |
102 GrGLSLFragmentProcessor* GrCircleBlurFragmentProcessor::onCreateGLSLInstance() c
onst { | 101 GrGLSLFragmentProcessor* GrCircleBlurFragmentProcessor::onCreateGLSLInstance() c
onst { |
103 return new GrGLCircleBlurFragmentProcessor(*this); | 102 return new GrGLCircleBlurFragmentProcessor; |
104 } | 103 } |
105 | 104 |
106 void GrCircleBlurFragmentProcessor::onGetGLSLProcessorKey(const GrGLSLCaps& caps
, | 105 void GrCircleBlurFragmentProcessor::onGetGLSLProcessorKey(const GrGLSLCaps& caps
, |
107 GrProcessorKeyBuilder*
b) const { | 106 GrProcessorKeyBuilder*
b) const { |
108 GrGLCircleBlurFragmentProcessor::GenKey(*this, caps, b); | 107 GrGLCircleBlurFragmentProcessor::GenKey(*this, caps, b); |
109 } | 108 } |
110 | 109 |
111 void GrCircleBlurFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput*
inout) const { | 110 void GrCircleBlurFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput*
inout) const { |
112 inout->mulByUnknownSingleComponent(); | 111 inout->mulByUnknownSingleComponent(); |
113 } | 112 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor); | 257 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor); |
259 | 258 |
260 const GrFragmentProcessor* GrCircleBlurFragmentProcessor::TestCreate(GrProcessor
TestData* d) { | 259 const GrFragmentProcessor* GrCircleBlurFragmentProcessor::TestCreate(GrProcessor
TestData* d) { |
261 SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f); | 260 SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f); |
262 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); | 261 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); |
263 SkRect circle = SkRect::MakeWH(wh, wh); | 262 SkRect circle = SkRect::MakeWH(wh, wh); |
264 return GrCircleBlurFragmentProcessor::Create(d->fContext->textureProvider(),
circle, sigma); | 263 return GrCircleBlurFragmentProcessor::Create(d->fContext->textureProvider(),
circle, sigma); |
265 } | 264 } |
266 | 265 |
267 #endif | 266 #endif |
OLD | NEW |