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

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

Issue 23826002: Rename ShaderType enum to ShaderVisibility (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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/SkBicubicImageFilter.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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 const char* outputColor, 347 const char* outputColor,
348 const char* inputColor, 348 const char* inputColor,
349 const TextureSamplerArray& samplers) { 349 const TextureSamplerArray& samplers) {
350 350
351 GrTexture* backgroundTex = drawEffect.castEffect<GrArithmeticEffect>().backg roundTexture(); 351 GrTexture* backgroundTex = drawEffect.castEffect<GrArithmeticEffect>().backg roundTexture();
352 const char* dstColor; 352 const char* dstColor;
353 if (backgroundTex) { 353 if (backgroundTex) {
354 SkString bgCoords; 354 SkString bgCoords;
355 GrSLType bgCoordsType = fBackgroundEffectMatrix.emitCode(builder, key, & bgCoords, NULL, "BG"); 355 GrSLType bgCoordsType = fBackgroundEffectMatrix.emitCode(builder, key, & bgCoords, NULL, "BG");
356 builder->fsCodeAppend("\t\tvec4 bgColor = "); 356 builder->fsCodeAppend("\t\tvec4 bgColor = ");
357 builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType, 357 builder->fsAppendTextureLookup(samplers[0], bgCoords.c_str(), bgCoordsTy pe);
358 samplers[0],
359 bgCoords.c_str(),
360 bgCoordsType);
361 builder->fsCodeAppendf(";\n"); 358 builder->fsCodeAppendf(";\n");
362 dstColor = "bgColor"; 359 dstColor = "bgColor";
363 } else { 360 } else {
364 dstColor = builder->dstColor(); 361 dstColor = builder->dstColor();
365 } 362 }
366 363
367 SkASSERT(NULL != dstColor); 364 SkASSERT(NULL != dstColor);
368 fKUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, 365 fKUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility,
369 kVec4f_GrSLType, "k"); 366 kVec4f_GrSLType, "k");
370 const char* kUni = builder->getUniformCStr(fKUni); 367 const char* kUni = builder->getUniformCStr(fKUni);
371 368
372 // We don't try to optimize for this case at all 369 // We don't try to optimize for this case at all
373 if (NULL == inputColor) { 370 if (NULL == inputColor) {
374 builder->fsCodeAppendf("\t\tconst vec4 src = %s;\n", GrGLSLOnesVecf(4)); 371 builder->fsCodeAppendf("\t\tconst vec4 src = %s;\n", GrGLSLOnesVecf(4));
375 } else { 372 } else {
376 builder->fsCodeAppendf("\t\tvec4 src = %s;\n", inputColor); 373 builder->fsCodeAppendf("\t\tvec4 src = %s;\n", inputColor);
377 if (gUseUnpremul) { 374 if (gUseUnpremul) {
378 builder->fsCodeAppendf("\t\tsrc.rgb = clamp(src.rgb / src.a, 0.0, 1. 0);\n"); 375 builder->fsCodeAppendf("\t\tsrc.rgb = clamp(src.rgb / src.a, 0.0, 1. 0);\n");
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 background); 443 background);
447 } 444 }
448 return true; 445 return true;
449 } 446 }
450 447
451 #endif 448 #endif
452 449
453 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 450 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
454 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 451 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
455 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 452 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/SkBicubicImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698