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 "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 const TextureSamplerArray& samplers) { | 147 const TextureSamplerArray& samplers) { |
148 fInnerThresholdVar = builder->addUniform( | 148 fInnerThresholdVar = builder->addUniform( |
149 GrGLProgramBuilder::kFragment_Visibility, | 149 GrGLProgramBuilder::kFragment_Visibility, |
150 kFloat_GrSLType, kDefault_GrSLPrecision, | 150 kFloat_GrSLType, kDefault_GrSLPrecision, |
151 "inner_threshold"); | 151 "inner_threshold"); |
152 fOuterThresholdVar = builder->addUniform( | 152 fOuterThresholdVar = builder->addUniform( |
153 GrGLProgramBuilder::kFragment_Visibility, | 153 GrGLProgramBuilder::kFragment_Visibility, |
154 kFloat_GrSLType, kDefault_GrSLPrecision, | 154 kFloat_GrSLType, kDefault_GrSLPrecision, |
155 "outer_threshold"); | 155 "outer_threshold"); |
156 | 156 |
157 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 157 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
158 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); | 158 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); |
159 SkString maskCoords2D = fsBuilder->ensureFSCoords2D(coords, 1); | 159 SkString maskCoords2D = fsBuilder->ensureFSCoords2D(coords, 1); |
160 | 160 |
161 fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str()); | 161 fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str()); |
162 fsBuilder->codeAppendf("\t\tvec2 mask_coord = %s;\n", maskCoords2D.c_str()); | 162 fsBuilder->codeAppendf("\t\tvec2 mask_coord = %s;\n", maskCoords2D.c_str()); |
163 fsBuilder->codeAppend("\t\tvec4 input_color = "); | 163 fsBuilder->codeAppend("\t\tvec4 input_color = "); |
164 fsBuilder->appendTextureLookup(samplers[0], "coord"); | 164 fsBuilder->appendTextureLookup(samplers[0], "coord"); |
165 fsBuilder->codeAppend(";\n"); | 165 fsBuilder->codeAppend(";\n"); |
166 fsBuilder->codeAppend("\t\tvec4 mask_color = "); | 166 fsBuilder->codeAppend("\t\tvec4 mask_color = "); |
167 fsBuilder->appendTextureLookup(samplers[1], "mask_coord"); | 167 fsBuilder->appendTextureLookup(samplers[1], "mask_coord"); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |