OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 355 |
356 GLProcessor(const GrProcessor&) {} | 356 GLProcessor(const GrProcessor&) {} |
357 | 357 |
358 virtual void emitCode(GrGLFPBuilder* builder, | 358 virtual void emitCode(GrGLFPBuilder* builder, |
359 const GrFragmentProcessor&, | 359 const GrFragmentProcessor&, |
360 const char* outputColor, | 360 const char* outputColor, |
361 const char* inputColor, | 361 const char* inputColor, |
362 const TransformedCoordsArray&, | 362 const TransformedCoordsArray&, |
363 const TextureSamplerArray&) SK_OVERRIDE { | 363 const TextureSamplerArray&) SK_OVERRIDE { |
364 fMatrixHandle = builder->addUniform(GrGLProgramBuilder::kFragment_Vi
sibility, | 364 fMatrixHandle = builder->addUniform(GrGLProgramBuilder::kFragment_Vi
sibility, |
365 kMat44f_GrSLType, | 365 kMat44f_GrSLType, kDefault_GrSLP
recision, |
366 "ColorMatrix"); | 366 "ColorMatrix"); |
367 fVectorHandle = builder->addUniform(GrGLProgramBuilder::kFragment_Vi
sibility, | 367 fVectorHandle = builder->addUniform(GrGLProgramBuilder::kFragment_Vi
sibility, |
368 kVec4f_GrSLType, | 368 kVec4f_GrSLType, kDefault_GrSLPr
ecision, |
369 "ColorMatrixVector"); | 369 "ColorMatrixVector"); |
370 | 370 |
371 if (NULL == inputColor) { | 371 if (NULL == inputColor) { |
372 // could optimize this case, but we aren't for now. | 372 // could optimize this case, but we aren't for now. |
373 inputColor = "vec4(1)"; | 373 inputColor = "vec4(1)"; |
374 } | 374 } |
375 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder
(); | 375 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder
(); |
376 // The max() is to guard against 0 / 0 during unpremul when the inco
ming color is | 376 // The max() is to guard against 0 / 0 during unpremul when the inco
ming color is |
377 // transparent black. | 377 // transparent black. |
378 fsBuilder->codeAppendf("\tfloat nonZeroAlpha = max(%s.a, 0.00001);\n
", inputColor); | 378 fsBuilder->codeAppendf("\tfloat nonZeroAlpha = max(%s.a, 0.00001);\n
", inputColor); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 str->append("matrix: ("); | 497 str->append("matrix: ("); |
498 for (int i = 0; i < 20; ++i) { | 498 for (int i = 0; i < 20; ++i) { |
499 str->appendScalar(fMatrix.fMat[i]); | 499 str->appendScalar(fMatrix.fMat[i]); |
500 if (i < 19) { | 500 if (i < 19) { |
501 str->append(", "); | 501 str->append(", "); |
502 } | 502 } |
503 } | 503 } |
504 str->append(")"); | 504 str->append(")"); |
505 } | 505 } |
506 #endif | 506 #endif |
OLD | NEW |