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

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

Issue 1109863004: Use GLSLCaps for creating processor keys and GLSL-specific programs (Closed) Base URL: https://chromium.googlesource.com/skia@master
Patch Set: Created 5 years, 7 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 | « include/gpu/effects/GrConstColorProcessor.h ('k') | src/effects/SkArithmeticMode_gpu.h » ('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 "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 outerThreshold)); 69 outerThreshold));
70 } 70 }
71 71
72 virtual ~AlphaThresholdEffect() {}; 72 virtual ~AlphaThresholdEffect() {};
73 73
74 const char* name() const override { return "Alpha Threshold"; } 74 const char* name() const override { return "Alpha Threshold"; }
75 75
76 float innerThreshold() const { return fInnerThreshold; } 76 float innerThreshold() const { return fInnerThreshold; }
77 float outerThreshold() const { return fOuterThreshold; } 77 float outerThreshold() const { return fOuterThreshold; }
78 78
79 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const overri de; 79 void getGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const over ride;
80 80
81 GrGLFragmentProcessor* createGLInstance() const override; 81 GrGLFragmentProcessor* createGLInstance() const override;
82 82
83 private: 83 private:
84 AlphaThresholdEffect(GrTexture* texture, 84 AlphaThresholdEffect(GrTexture* texture,
85 GrTexture* maskTexture, 85 GrTexture* maskTexture,
86 float innerThreshold, 86 float innerThreshold,
87 float outerThreshold) 87 float outerThreshold)
88 : fInnerThreshold(innerThreshold) 88 : fInnerThreshold(innerThreshold)
89 , fOuterThreshold(outerThreshold) 89 , fOuterThreshold(outerThreshold)
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 GrTexture** textures) { 207 GrTexture** textures) {
208 GrTexture* bmpTex = textures[GrProcessorUnitTest::kSkiaPMTextureIdx]; 208 GrTexture* bmpTex = textures[GrProcessorUnitTest::kSkiaPMTextureIdx];
209 GrTexture* maskTex = textures[GrProcessorUnitTest::kAlphaTextureIdx]; 209 GrTexture* maskTex = textures[GrProcessorUnitTest::kAlphaTextureIdx];
210 float inner_thresh = random->nextUScalar1(); 210 float inner_thresh = random->nextUScalar1();
211 float outer_thresh = random->nextUScalar1(); 211 float outer_thresh = random->nextUScalar1();
212 return AlphaThresholdEffect::Create(bmpTex, maskTex, inner_thresh, outer_thr esh); 212 return AlphaThresholdEffect::Create(bmpTex, maskTex, inner_thresh, outer_thr esh);
213 } 213 }
214 214
215 /////////////////////////////////////////////////////////////////////////////// 215 ///////////////////////////////////////////////////////////////////////////////
216 216
217 void AlphaThresholdEffect::getGLProcessorKey(const GrGLCaps& caps, 217 void AlphaThresholdEffect::getGLProcessorKey(const GrGLSLCaps& caps,
218 GrProcessorKeyBuilder* b) const { 218 GrProcessorKeyBuilder* b) const {
219 GrGLAlphaThresholdEffect::GenKey(*this, caps, b); 219 GrGLAlphaThresholdEffect::GenKey(*this, caps, b);
220 } 220 }
221 221
222 GrGLFragmentProcessor* AlphaThresholdEffect::createGLInstance() const { 222 GrGLFragmentProcessor* AlphaThresholdEffect::createGLInstance() const {
223 return SkNEW_ARGS(GrGLAlphaThresholdEffect, (*this)); 223 return SkNEW_ARGS(GrGLAlphaThresholdEffect, (*this));
224 } 224 }
225 225
226 bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const { 226 bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
227 const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>(); 227 const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 } 377 }
378 378
379 #ifndef SK_IGNORE_TO_STRING 379 #ifndef SK_IGNORE_TO_STRING
380 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { 380 void SkAlphaThresholdFilterImpl::toString(SkString* str) const {
381 str->appendf("SkAlphaThresholdImageFilter: ("); 381 str->appendf("SkAlphaThresholdImageFilter: (");
382 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); 382 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold);
383 str->append(")"); 383 str->append(")");
384 } 384 }
385 #endif 385 #endif
386 386
OLDNEW
« no previous file with comments | « include/gpu/effects/GrConstColorProcessor.h ('k') | src/effects/SkArithmeticMode_gpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698