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

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

Issue 1666773002: Clean up GrGLSLFragmentProcessor-derived classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months 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.cpp ('k') | src/effects/SkArithmeticMode_gpu.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 #include "SkAlphaThresholdFilter.h" 8 #include "SkAlphaThresholdFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 GrCoordTransform fImageCoordTransform; 136 GrCoordTransform fImageCoordTransform;
137 GrTextureAccess fImageTextureAccess; 137 GrTextureAccess fImageTextureAccess;
138 GrCoordTransform fMaskCoordTransform; 138 GrCoordTransform fMaskCoordTransform;
139 GrTextureAccess fMaskTextureAccess; 139 GrTextureAccess fMaskTextureAccess;
140 140
141 typedef GrFragmentProcessor INHERITED; 141 typedef GrFragmentProcessor INHERITED;
142 }; 142 };
143 143
144 class GrGLAlphaThresholdEffect : public GrGLSLFragmentProcessor { 144 class GrGLAlphaThresholdEffect : public GrGLSLFragmentProcessor {
145 public: 145 public:
146 GrGLAlphaThresholdEffect(const GrFragmentProcessor&) {} 146 void emitCode(EmitArgs&) override;
147
148 virtual void emitCode(EmitArgs&) override;
149 147
150 protected: 148 protected:
151 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override ; 149 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override ;
152 150
153 private: 151 private:
154 152
155 GrGLSLProgramDataManager::UniformHandle fInnerThresholdVar; 153 GrGLSLProgramDataManager::UniformHandle fInnerThresholdVar;
156 GrGLSLProgramDataManager::UniformHandle fOuterThresholdVar; 154 GrGLSLProgramDataManager::UniformHandle fOuterThresholdVar;
157 155
158 typedef GrGLSLFragmentProcessor INHERITED; 156 typedef GrGLSLFragmentProcessor INHERITED;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 228 }
231 229
232 /////////////////////////////////////////////////////////////////////////////// 230 ///////////////////////////////////////////////////////////////////////////////
233 231
234 void AlphaThresholdEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, 232 void AlphaThresholdEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps,
235 GrProcessorKeyBuilder* b) const { 233 GrProcessorKeyBuilder* b) const {
236 GrGLAlphaThresholdEffect::GenKey(*this, caps, b); 234 GrGLAlphaThresholdEffect::GenKey(*this, caps, b);
237 } 235 }
238 236
239 GrGLSLFragmentProcessor* AlphaThresholdEffect::onCreateGLSLInstance() const { 237 GrGLSLFragmentProcessor* AlphaThresholdEffect::onCreateGLSLInstance() const {
240 return new GrGLAlphaThresholdEffect(*this); 238 return new GrGLAlphaThresholdEffect;
241 } 239 }
242 240
243 bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const { 241 bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
244 const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>(); 242 const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>();
245 return (this->fInnerThreshold == s.fInnerThreshold && 243 return (this->fInnerThreshold == s.fInnerThreshold &&
246 this->fOuterThreshold == s.fOuterThreshold); 244 this->fOuterThreshold == s.fOuterThreshold);
247 } 245 }
248 246
249 void AlphaThresholdEffect::onComputeInvariantOutput(GrInvariantOutput* inout) co nst { 247 void AlphaThresholdEffect::onComputeInvariantOutput(GrInvariantOutput* inout) co nst {
250 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) { 248 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 398 }
401 399
402 #ifndef SK_IGNORE_TO_STRING 400 #ifndef SK_IGNORE_TO_STRING
403 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { 401 void SkAlphaThresholdFilterImpl::toString(SkString* str) const {
404 str->appendf("SkAlphaThresholdImageFilter: ("); 402 str->appendf("SkAlphaThresholdImageFilter: (");
405 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); 403 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold);
406 str->append(")"); 404 str->append(")");
407 } 405 }
408 #endif 406 #endif
409 407
OLDNEW
« no previous file with comments | « src/effects/GrCircleBlurFragmentProcessor.cpp ('k') | src/effects/SkArithmeticMode_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698