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

Side by Side Diff: src/effects/SkArithmeticMode.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 | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/effects/SkBlurMaskFilter.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 "SkArithmeticMode.h" 8 #include "SkArithmeticMode.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 fsBuilder->codeAppend("\t\tvec4 bgColor = "); 364 fsBuilder->codeAppend("\t\tvec4 bgColor = ");
365 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0] .getType()); 365 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0] .getType());
366 fsBuilder->codeAppendf(";\n"); 366 fsBuilder->codeAppendf(";\n");
367 dstColor = "bgColor"; 367 dstColor = "bgColor";
368 } else { 368 } else {
369 dstColor = fsBuilder->dstColor(); 369 dstColor = fsBuilder->dstColor();
370 } 370 }
371 371
372 SkASSERT(dstColor); 372 SkASSERT(dstColor);
373 fKUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, 373 fKUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
374 kVec4f_GrSLType, "k"); 374 kVec4f_GrSLType, kDefault_GrSLPrecision,
375 "k");
375 const char* kUni = builder->getUniformCStr(fKUni); 376 const char* kUni = builder->getUniformCStr(fKUni);
376 377
377 // We don't try to optimize for this case at all 378 // We don't try to optimize for this case at all
378 if (NULL == inputColor) { 379 if (NULL == inputColor) {
379 fsBuilder->codeAppendf("\t\tconst vec4 src = vec4(1);\n"); 380 fsBuilder->codeAppendf("\t\tconst vec4 src = vec4(1);\n");
380 } else { 381 } else {
381 fsBuilder->codeAppendf("\t\tvec4 src = %s;\n", inputColor); 382 fsBuilder->codeAppendf("\t\tvec4 src = %s;\n", inputColor);
382 if (gUseUnpremul) { 383 if (gUseUnpremul) {
383 fsBuilder->codeAppendf("\t\tsrc.rgb = clamp(src.rgb / src.a, 0.0, 1. 0);\n"); 384 fsBuilder->codeAppendf("\t\tsrc.rgb = clamp(src.rgb / src.a, 0.0, 1. 0);\n");
384 } 385 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 background); 442 background);
442 } 443 }
443 return true; 444 return true;
444 } 445 }
445 446
446 #endif 447 #endif
447 448
448 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 449 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
449 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 450 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
450 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 451 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698