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

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

Issue 25048002: Express (GLSL expression, possibly known value) pairs as a class (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: addressing review comments Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/SkBitmapAlphaThresholdShader.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 "SkFlattenableBuffers.h" 10 #include "SkFlattenableBuffers.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 dstColor = builder->dstColor(); 359 dstColor = builder->dstColor();
360 } 360 }
361 361
362 SkASSERT(NULL != dstColor); 362 SkASSERT(NULL != dstColor);
363 fKUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility, 363 fKUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility,
364 kVec4f_GrSLType, "k"); 364 kVec4f_GrSLType, "k");
365 const char* kUni = builder->getUniformCStr(fKUni); 365 const char* kUni = builder->getUniformCStr(fKUni);
366 366
367 // We don't try to optimize for this case at all 367 // We don't try to optimize for this case at all
368 if (NULL == inputColor) { 368 if (NULL == inputColor) {
369 builder->fsCodeAppendf("\t\tconst vec4 src = %s;\n", GrGLSLOnesVecf(4)); 369 builder->fsCodeAppendf("\t\tconst vec4 src = vec4(1);\n");
370 } else { 370 } else {
371 builder->fsCodeAppendf("\t\tvec4 src = %s;\n", inputColor); 371 builder->fsCodeAppendf("\t\tvec4 src = %s;\n", inputColor);
372 if (gUseUnpremul) { 372 if (gUseUnpremul) {
373 builder->fsCodeAppendf("\t\tsrc.rgb = clamp(src.rgb / src.a, 0.0, 1. 0);\n"); 373 builder->fsCodeAppendf("\t\tsrc.rgb = clamp(src.rgb / src.a, 0.0, 1. 0);\n");
374 } 374 }
375 } 375 }
376 376
377 builder->fsCodeAppendf("\t\tvec4 dst = %s;\n", dstColor); 377 builder->fsCodeAppendf("\t\tvec4 dst = %s;\n", dstColor);
378 if (gUseUnpremul) { 378 if (gUseUnpremul) {
379 builder->fsCodeAppendf("\t\tdst.rgb = clamp(dst.rgb / dst.a, 0.0, 1.0);\ n"); 379 builder->fsCodeAppendf("\t\tdst.rgb = clamp(dst.rgb / dst.a, 0.0, 1.0);\ n");
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 background); 421 background);
422 } 422 }
423 return true; 423 return true;
424 } 424 }
425 425
426 #endif 426 #endif
427 427
428 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 428 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
429 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 429 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
430 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 430 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/SkBitmapAlphaThresholdShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698