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

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

Issue 1110033004: Make XPFragmentBuilder only Builder with access to DstCopy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkDisplacementMapEffect.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 2011 Google Inc. 2 * Copyright 2011 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 "SkColorMatrixFilter.h" 8 #include "SkColorMatrixFilter.h"
9 #include "SkColorMatrix.h" 9 #include "SkColorMatrix.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 kMat44f_GrSLType, kDefault_GrSLP recision, 437 kMat44f_GrSLType, kDefault_GrSLP recision,
438 "ColorMatrix"); 438 "ColorMatrix");
439 fVectorHandle = builder->addUniform(GrGLProgramBuilder::kFragment_Vi sibility, 439 fVectorHandle = builder->addUniform(GrGLProgramBuilder::kFragment_Vi sibility,
440 kVec4f_GrSLType, kDefault_GrSLPr ecision, 440 kVec4f_GrSLType, kDefault_GrSLPr ecision,
441 "ColorMatrixVector"); 441 "ColorMatrixVector");
442 442
443 if (NULL == inputColor) { 443 if (NULL == inputColor) {
444 // could optimize this case, but we aren't for now. 444 // could optimize this case, but we aren't for now.
445 inputColor = "vec4(1)"; 445 inputColor = "vec4(1)";
446 } 446 }
447 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder (); 447 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder() ;
448 // The max() is to guard against 0 / 0 during unpremul when the inco ming color is 448 // The max() is to guard against 0 / 0 during unpremul when the inco ming color is
449 // transparent black. 449 // transparent black.
450 fsBuilder->codeAppendf("\tfloat nonZeroAlpha = max(%s.a, 0.00001);\n ", inputColor); 450 fsBuilder->codeAppendf("\tfloat nonZeroAlpha = max(%s.a, 0.00001);\n ", inputColor);
451 fsBuilder->codeAppendf("\t%s = %s * vec4(%s.rgb / nonZeroAlpha, nonZ eroAlpha) + %s;\n", 451 fsBuilder->codeAppendf("\t%s = %s * vec4(%s.rgb / nonZeroAlpha, nonZ eroAlpha) + %s;\n",
452 outputColor, 452 outputColor,
453 builder->getUniformCStr(fMatrixHandle), 453 builder->getUniformCStr(fMatrixHandle),
454 inputColor, 454 inputColor,
455 builder->getUniformCStr(fVectorHandle)); 455 builder->getUniformCStr(fVectorHandle));
456 fsBuilder->codeAppendf("\t%s = clamp(%s, 0.0, 1.0);\n", outputColor, outputColor); 456 fsBuilder->codeAppendf("\t%s = clamp(%s, 0.0, 1.0);\n", outputColor, outputColor);
457 fsBuilder->codeAppendf("\t%s.rgb *= %s.a;\n", outputColor, outputCol or); 457 fsBuilder->codeAppendf("\t%s.rgb *= %s.a;\n", outputColor, outputCol or);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 str->append("matrix: ("); 577 str->append("matrix: (");
578 for (int i = 0; i < 20; ++i) { 578 for (int i = 0; i < 20; ++i) {
579 str->appendScalar(fMatrix.fMat[i]); 579 str->appendScalar(fMatrix.fMat[i]);
580 if (i < 19) { 580 if (i < 19) {
581 str->append(", "); 581 str->append(", ");
582 } 582 }
583 } 583 }
584 str->append(")"); 584 str->append(")");
585 } 585 }
586 #endif 586 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698