OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |