Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: src/effects/GrCircleBlurFragmentProcessor.cpp

Issue 1434313002: Make all GrFragmentProcessors GL independent. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/GrCircleBlurFragmentProcessor.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrTextureProvider.h" 14 #include "GrTextureProvider.h"
15 15
16 #include "gl/GrGLFragmentProcessor.h" 16 #include "glsl/GrGLSLFragmentProcessor.h"
17 #include "glsl/GrGLSLFragmentShaderBuilder.h" 17 #include "glsl/GrGLSLFragmentShaderBuilder.h"
18 #include "glsl/GrGLSLProgramBuilder.h" 18 #include "glsl/GrGLSLProgramBuilder.h"
19 #include "glsl/GrGLSLProgramDataManager.h" 19 #include "glsl/GrGLSLProgramDataManager.h"
20 20
21 class GrGLCircleBlurFragmentProcessor : public GrGLFragmentProcessor { 21 class GrGLCircleBlurFragmentProcessor : public GrGLSLFragmentProcessor {
22 public: 22 public:
23 GrGLCircleBlurFragmentProcessor(const GrProcessor&) {} 23 GrGLCircleBlurFragmentProcessor(const GrProcessor&) {}
24 void emitCode(EmitArgs&) override; 24 void emitCode(EmitArgs&) override;
25 25
26 protected: 26 protected:
27 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override ; 27 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override ;
28 28
29 private: 29 private:
30 GrGLSLProgramDataManager::UniformHandle fDataUniform; 30 GrGLSLProgramDataManager::UniformHandle fDataUniform;
31 31
32 typedef GrGLFragmentProcessor INHERITED; 32 typedef GrGLSLFragmentProcessor INHERITED;
33 }; 33 };
34 34
35 void GrGLCircleBlurFragmentProcessor::emitCode(EmitArgs& args) { 35 void GrGLCircleBlurFragmentProcessor::emitCode(EmitArgs& args) {
36 36
37 const char *dataName; 37 const char *dataName;
38 38
39 // The data is formatted as: 39 // The data is formatted as:
40 // x,y - the center of the circle 40 // x,y - the center of the circle
41 // z - the distance at which the intensity starts falling off (e.g., the start of the table) 41 // z - the distance at which the intensity starts falling off (e.g., the start of the table)
42 // w - the size of the profile texture 42 // w - the size of the profile texture
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 GrTexture* blurProf ile) 86 GrTexture* blurProf ile)
87 : fCircle(circle) 87 : fCircle(circle)
88 , fSigma(sigma) 88 , fSigma(sigma)
89 , fOffset(offset) 89 , fOffset(offset)
90 , fBlurProfileAccess(blurProfile, GrTextureParams::kBilerp_FilterMode) { 90 , fBlurProfileAccess(blurProfile, GrTextureParams::kBilerp_FilterMode) {
91 this->initClassID<GrCircleBlurFragmentProcessor>(); 91 this->initClassID<GrCircleBlurFragmentProcessor>();
92 this->addTextureAccess(&fBlurProfileAccess); 92 this->addTextureAccess(&fBlurProfileAccess);
93 this->setWillReadFragmentPosition(); 93 this->setWillReadFragmentPosition();
94 } 94 }
95 95
96 GrGLFragmentProcessor* GrCircleBlurFragmentProcessor::onCreateGLInstance() const { 96 GrGLSLFragmentProcessor* GrCircleBlurFragmentProcessor::onCreateGLInstance() con st {
97 return new GrGLCircleBlurFragmentProcessor(*this); 97 return new GrGLCircleBlurFragmentProcessor(*this);
98 } 98 }
99 99
100 void GrCircleBlurFragmentProcessor::onGetGLProcessorKey(const GrGLSLCaps& caps, 100 void GrCircleBlurFragmentProcessor::onGetGLProcessorKey(const GrGLSLCaps& caps,
101 GrProcessorKeyBuilder* b ) const { 101 GrProcessorKeyBuilder* b ) const {
102 GrGLCircleBlurFragmentProcessor::GenKey(*this, caps, b); 102 GrGLCircleBlurFragmentProcessor::GenKey(*this, caps, b);
103 } 103 }
104 104
105 void GrCircleBlurFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const { 105 void GrCircleBlurFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const {
106 inout->mulByUnknownSingleComponent(); 106 inout->mulByUnknownSingleComponent();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor); 252 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor);
253 253
254 const GrFragmentProcessor* GrCircleBlurFragmentProcessor::TestCreate(GrProcessor TestData* d) { 254 const GrFragmentProcessor* GrCircleBlurFragmentProcessor::TestCreate(GrProcessor TestData* d) {
255 SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f); 255 SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f);
256 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); 256 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f);
257 SkRect circle = SkRect::MakeWH(wh, wh); 257 SkRect circle = SkRect::MakeWH(wh, wh);
258 return GrCircleBlurFragmentProcessor::Create(d->fContext->textureProvider(), circle, sigma); 258 return GrCircleBlurFragmentProcessor::Create(d->fContext->textureProvider(), circle, sigma);
259 } 259 }
260 260
261 #endif 261 #endif
OLDNEW
« no previous file with comments | « src/effects/GrCircleBlurFragmentProcessor.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698