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

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

Issue 788733003: Make addUniform take a precision (Closed) Base URL: https://skia.googlesource.com/skia.git@move_prec
Patch Set: rebase Created 6 years 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/GrTypesPriv.h ('k') | src/effects/SkArithmeticMode.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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 }; 136 };
137 137
138 void GrGLAlphaThresholdEffect::emitCode(GrGLFPBuilder* builder, 138 void GrGLAlphaThresholdEffect::emitCode(GrGLFPBuilder* builder,
139 const GrFragmentProcessor&, 139 const GrFragmentProcessor&,
140 const char* outputColor, 140 const char* outputColor,
141 const char* inputColor, 141 const char* inputColor,
142 const TransformedCoordsArray& coords, 142 const TransformedCoordsArray& coords,
143 const TextureSamplerArray& samplers) { 143 const TextureSamplerArray& samplers) {
144 fInnerThresholdVar = builder->addUniform( 144 fInnerThresholdVar = builder->addUniform(
145 GrGLProgramBuilder::kFragment_Visibility, 145 GrGLProgramBuilder::kFragment_Visibility,
146 kFloat_GrSLType, "inner_threshold"); 146 kFloat_GrSLType, kDefault_GrSLPrecision,
147 "inner_threshold");
147 fOuterThresholdVar = builder->addUniform( 148 fOuterThresholdVar = builder->addUniform(
148 GrGLProgramBuilder::kFragment_Visibility, 149 GrGLProgramBuilder::kFragment_Visibility,
149 kFloat_GrSLType, "outer_threshold"); 150 kFloat_GrSLType, kDefault_GrSLPrecision,
151 "outer_threshold");
150 152
151 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 153 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
152 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); 154 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
153 SkString maskCoords2D = fsBuilder->ensureFSCoords2D(coords, 1); 155 SkString maskCoords2D = fsBuilder->ensureFSCoords2D(coords, 1);
154 156
155 fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str()); 157 fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
156 fsBuilder->codeAppendf("\t\tvec2 mask_coord = %s;\n", maskCoords2D.c_str()); 158 fsBuilder->codeAppendf("\t\tvec2 mask_coord = %s;\n", maskCoords2D.c_str());
157 fsBuilder->codeAppend("\t\tvec4 input_color = "); 159 fsBuilder->codeAppend("\t\tvec4 input_color = ");
158 fsBuilder->appendTextureLookup(samplers[0], "coord"); 160 fsBuilder->appendTextureLookup(samplers[0], "coord");
159 fsBuilder->codeAppend(";\n"); 161 fsBuilder->codeAppend(";\n");
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 (U8CPU)(SkColorGetG(source) * scale), 368 (U8CPU)(SkColorGetG(source) * scale),
367 (U8CPU)(SkColorGetB(source) * scale)); 369 (U8CPU)(SkColorGetB(source) * scale));
368 } 370 }
369 } 371 }
370 dptr[y * dst->width() + x] = output_color; 372 dptr[y * dst->width() + x] = output_color;
371 } 373 }
372 } 374 }
373 375
374 return true; 376 return true;
375 } 377 }
OLDNEW
« no previous file with comments | « include/gpu/GrTypesPriv.h ('k') | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698