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

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

Issue 1709153002: Add more specialized fragment builders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make MSVC happy 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 void GrGLAlphaThresholdEffect::emitCode(EmitArgs& args) { 158 void GrGLAlphaThresholdEffect::emitCode(EmitArgs& args) {
159 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; 159 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
160 fInnerThresholdVar = uniformHandler->addUniform(kFragment_GrShaderFlag, 160 fInnerThresholdVar = uniformHandler->addUniform(kFragment_GrShaderFlag,
161 kFloat_GrSLType, kDefault_Gr SLPrecision, 161 kFloat_GrSLType, kDefault_Gr SLPrecision,
162 "inner_threshold"); 162 "inner_threshold");
163 fOuterThresholdVar = uniformHandler->addUniform(kFragment_GrShaderFlag, 163 fOuterThresholdVar = uniformHandler->addUniform(kFragment_GrShaderFlag,
164 kFloat_GrSLType, kDefault_Gr SLPrecision, 164 kFloat_GrSLType, kDefault_Gr SLPrecision,
165 "outer_threshold"); 165 "outer_threshold");
166 166
167 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 167 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
168 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); 168 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
169 SkString maskCoords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 1); 169 SkString maskCoords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 1);
170 170
171 fragBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str()); 171 fragBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
172 fragBuilder->codeAppendf("\t\tvec2 mask_coord = %s;\n", maskCoords2D.c_str() ); 172 fragBuilder->codeAppendf("\t\tvec2 mask_coord = %s;\n", maskCoords2D.c_str() );
173 fragBuilder->codeAppend("\t\tvec4 input_color = "); 173 fragBuilder->codeAppend("\t\tvec4 input_color = ");
174 fragBuilder->appendTextureLookup(args.fSamplers[0], "coord"); 174 fragBuilder->appendTextureLookup(args.fSamplers[0], "coord");
175 fragBuilder->codeAppend(";\n"); 175 fragBuilder->codeAppend(";\n");
176 fragBuilder->codeAppend("\t\tvec4 mask_color = "); 176 fragBuilder->codeAppend("\t\tvec4 mask_color = ");
177 fragBuilder->appendTextureLookup(args.fSamplers[1], "mask_coord"); 177 fragBuilder->appendTextureLookup(args.fSamplers[1], "mask_coord");
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 397 }
398 398
399 #ifndef SK_IGNORE_TO_STRING 399 #ifndef SK_IGNORE_TO_STRING
400 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { 400 void SkAlphaThresholdFilterImpl::toString(SkString* str) const {
401 str->appendf("SkAlphaThresholdImageFilter: ("); 401 str->appendf("SkAlphaThresholdImageFilter: (");
402 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); 402 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold);
403 str->append(")"); 403 str->append(")");
404 } 404 }
405 #endif 405 #endif
406 406
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