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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 // underflow this may deviate from the actual result. Maybe the effect s
hould pin its | 384 // underflow this may deviate from the actual result. Maybe the effect s
hould pin its |
385 // result if the matrix could over/underflow for any component? | 385 // result if the matrix could over/underflow for any component? |
386 *color = static_cast<uint8_t>(SkScalarPin(outputA, 0, 255)) << GrColor_S
HIFT_A; | 386 *color = static_cast<uint8_t>(SkScalarPin(outputA, 0, 255)) << GrColor_S
HIFT_A; |
387 } | 387 } |
388 | 388 |
389 GR_DECLARE_EFFECT_TEST; | 389 GR_DECLARE_EFFECT_TEST; |
390 | 390 |
391 class GLEffect : public GrGLEffect { | 391 class GLEffect : public GrGLEffect { |
392 public: | 392 public: |
393 // this class always generates the same code. | 393 // this class always generates the same code. |
394 static EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&) { return 0
; } | 394 static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuil
der* b) {} |
395 | 395 |
396 GLEffect(const GrBackendEffectFactory& factory, | 396 GLEffect(const GrBackendEffectFactory& factory, |
397 const GrDrawEffect&) | 397 const GrDrawEffect&) |
398 : INHERITED(factory) { | 398 : INHERITED(factory) { |
399 } | 399 } |
400 | 400 |
401 virtual void emitCode(GrGLShaderBuilder* builder, | 401 virtual void emitCode(GrGLShaderBuilder* builder, |
402 const GrDrawEffect&, | 402 const GrDrawEffect&, |
403 EffectKey, | 403 const GrEffectKey&, |
404 const char* outputColor, | 404 const char* outputColor, |
405 const char* inputColor, | 405 const char* inputColor, |
406 const TransformedCoordsArray&, | 406 const TransformedCoordsArray&, |
407 const TextureSamplerArray&) SK_OVERRIDE { | 407 const TextureSamplerArray&) SK_OVERRIDE { |
408 fMatrixHandle = builder->addUniform(GrGLShaderBuilder::kFragment_Vis
ibility, | 408 fMatrixHandle = builder->addUniform(GrGLShaderBuilder::kFragment_Vis
ibility, |
409 kMat44f_GrSLType, | 409 kMat44f_GrSLType, |
410 "ColorMatrix"); | 410 "ColorMatrix"); |
411 fVectorHandle = builder->addUniform(GrGLShaderBuilder::kFragment_Vis
ibility, | 411 fVectorHandle = builder->addUniform(GrGLShaderBuilder::kFragment_Vis
ibility, |
412 kVec4f_GrSLType, | 412 kVec4f_GrSLType, |
413 "ColorMatrixVector"); | 413 "ColorMatrixVector"); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 str->append("matrix: ("); | 493 str->append("matrix: ("); |
494 for (int i = 0; i < 20; ++i) { | 494 for (int i = 0; i < 20; ++i) { |
495 str->appendScalar(fMatrix.fMat[i]); | 495 str->appendScalar(fMatrix.fMat[i]); |
496 if (i < 19) { | 496 if (i < 19) { |
497 str->append(", "); | 497 str->append(", "); |
498 } | 498 } |
499 } | 499 } |
500 str->append(")"); | 500 str->append(")"); |
501 } | 501 } |
502 #endif | 502 #endif |
OLD | NEW |