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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |