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

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

Issue 1213623022: fix up test create functions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 5 years, 5 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/GrProcessorUnitTest.h ('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 "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 const GrProcessor& proc) { 200 const GrProcessor& proc) {
201 const AlphaThresholdEffect& alpha_threshold = proc.cast<AlphaThresholdEffect >(); 201 const AlphaThresholdEffect& alpha_threshold = proc.cast<AlphaThresholdEffect >();
202 pdman.set1f(fInnerThresholdVar, alpha_threshold.innerThreshold()); 202 pdman.set1f(fInnerThresholdVar, alpha_threshold.innerThreshold());
203 pdman.set1f(fOuterThresholdVar, alpha_threshold.outerThreshold()); 203 pdman.set1f(fOuterThresholdVar, alpha_threshold.outerThreshold());
204 } 204 }
205 205
206 ///////////////////////////////////////////////////////////////////// 206 /////////////////////////////////////////////////////////////////////
207 207
208 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AlphaThresholdEffect); 208 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AlphaThresholdEffect);
209 209
210 GrFragmentProcessor* AlphaThresholdEffect::TestCreate(SkRandom* random, 210 GrFragmentProcessor* AlphaThresholdEffect::TestCreate(GrProcessorTestData* d) {
211 GrContext* context, 211 GrTexture* bmpTex = d->fTextures[GrProcessorUnitTest::kSkiaPMTextureIdx];
212 const GrCaps&, 212 GrTexture* maskTex = d->fTextures[GrProcessorUnitTest::kAlphaTextureIdx];
213 GrTexture** textures) { 213 float innerThresh = d->fRandom->nextUScalar1();
214 GrTexture* bmpTex = textures[GrProcessorUnitTest::kSkiaPMTextureIdx]; 214 float outerThresh = d->fRandom->nextUScalar1();
215 GrTexture* maskTex = textures[GrProcessorUnitTest::kAlphaTextureIdx]; 215 return AlphaThresholdEffect::Create(d->fShaderDataManager, bmpTex, maskTex, innerThresh,
216 float inner_thresh = random->nextUScalar1(); 216 outerThresh);
217 float outer_thresh = random->nextUScalar1();
218 GrShaderDataManager shaderDataManager;
219 return AlphaThresholdEffect::Create(&shaderDataManager, bmpTex, maskTex, inn er_thresh,
220 outer_thresh);
221 } 217 }
222 218
223 /////////////////////////////////////////////////////////////////////////////// 219 ///////////////////////////////////////////////////////////////////////////////
224 220
225 void AlphaThresholdEffect::getGLProcessorKey(const GrGLSLCaps& caps, 221 void AlphaThresholdEffect::getGLProcessorKey(const GrGLSLCaps& caps,
226 GrProcessorKeyBuilder* b) const { 222 GrProcessorKeyBuilder* b) const {
227 GrGLAlphaThresholdEffect::GenKey(*this, caps, b); 223 GrGLAlphaThresholdEffect::GenKey(*this, caps, b);
228 } 224 }
229 225
230 GrGLFragmentProcessor* AlphaThresholdEffect::createGLInstance() const { 226 GrGLFragmentProcessor* AlphaThresholdEffect::createGLInstance() const {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 384 }
389 385
390 #ifndef SK_IGNORE_TO_STRING 386 #ifndef SK_IGNORE_TO_STRING
391 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { 387 void SkAlphaThresholdFilterImpl::toString(SkString* str) const {
392 str->appendf("SkAlphaThresholdImageFilter: ("); 388 str->appendf("SkAlphaThresholdImageFilter: (");
393 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); 389 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold);
394 str->append(")"); 390 str->append(")");
395 } 391 }
396 #endif 392 #endif
397 393
OLDNEW
« no previous file with comments | « include/gpu/GrProcessorUnitTest.h ('k') | src/effects/SkArithmeticMode_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698