OLD | NEW |
1 | 1 |
2 #include "SkBitmap.h" | 2 #include "SkBitmap.h" |
3 #include "SkTableColorFilter.h" | 3 #include "SkTableColorFilter.h" |
4 #include "SkColorPriv.h" | 4 #include "SkColorPriv.h" |
5 #include "SkReadBuffer.h" | 5 #include "SkReadBuffer.h" |
6 #include "SkWriteBuffer.h" | 6 #include "SkWriteBuffer.h" |
7 #include "SkUnPreMultiply.h" | 7 #include "SkUnPreMultiply.h" |
8 #include "SkString.h" | 8 #include "SkString.h" |
9 | 9 |
10 class SkTable_ColorFilter : public SkColorFilter { | 10 class SkTable_ColorFilter : public SkColorFilter { |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 return GrTBackendFragmentProcessorFactory<ColorTableEffect>::getInstance(); | 397 return GrTBackendFragmentProcessorFactory<ColorTableEffect>::getInstance(); |
398 } | 398 } |
399 | 399 |
400 bool ColorTableEffect::onIsEqual(const GrProcessor& sBase) const { | 400 bool ColorTableEffect::onIsEqual(const GrProcessor& sBase) const { |
401 return this->texture(0) == sBase.texture(0); | 401 return this->texture(0) == sBase.texture(0); |
402 } | 402 } |
403 | 403 |
404 void ColorTableEffect::onComputeInvariantOutput(InvariantOutput* inout) const { | 404 void ColorTableEffect::onComputeInvariantOutput(InvariantOutput* inout) const { |
405 // If we kept the table in the effect then we could actually run known input
s through the | 405 // If we kept the table in the effect then we could actually run known input
s through the |
406 // table. | 406 // table. |
| 407 uint8_t invalidateFlags = 0; |
407 if (fFlags & SkTable_ColorFilter::kR_Flag) { | 408 if (fFlags & SkTable_ColorFilter::kR_Flag) { |
408 inout->fValidFlags &= ~kR_GrColorComponentFlag; | 409 invalidateFlags |= kR_GrColorComponentFlag; |
409 } | 410 } |
410 if (fFlags & SkTable_ColorFilter::kG_Flag) { | 411 if (fFlags & SkTable_ColorFilter::kG_Flag) { |
411 inout->fValidFlags &= ~kG_GrColorComponentFlag; | 412 invalidateFlags |= kG_GrColorComponentFlag; |
412 } | 413 } |
413 if (fFlags & SkTable_ColorFilter::kB_Flag) { | 414 if (fFlags & SkTable_ColorFilter::kB_Flag) { |
414 inout->fValidFlags &= ~kB_GrColorComponentFlag; | 415 invalidateFlags |= kB_GrColorComponentFlag; |
415 } | 416 } |
416 if (fFlags & SkTable_ColorFilter::kA_Flag) { | 417 if (fFlags & SkTable_ColorFilter::kA_Flag) { |
417 inout->fValidFlags &= ~kA_GrColorComponentFlag; | 418 invalidateFlags |= kA_GrColorComponentFlag; |
418 } | 419 } |
419 inout->fIsSingleComponent = false; | 420 inout->invalidateComponents(invalidateFlags); |
420 } | 421 } |
421 | 422 |
422 /////////////////////////////////////////////////////////////////////////////// | 423 /////////////////////////////////////////////////////////////////////////////// |
423 | 424 |
424 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ColorTableEffect); | 425 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ColorTableEffect); |
425 | 426 |
426 GrFragmentProcessor* ColorTableEffect::TestCreate(SkRandom* random, | 427 GrFragmentProcessor* ColorTableEffect::TestCreate(SkRandom* random, |
427 GrContext* context, | 428 GrContext* context, |
428 const GrDrawTargetCaps&, | 429 const GrDrawTargetCaps&, |
429 GrTexture* textures[]) { | 430 GrTexture* textures[]) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], | 462 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], |
462 const uint8_t tableR[256], | 463 const uint8_t tableR[256], |
463 const uint8_t tableG[256], | 464 const uint8_t tableG[256], |
464 const uint8_t tableB[256]) { | 465 const uint8_t tableB[256]) { |
465 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); | 466 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); |
466 } | 467 } |
467 | 468 |
468 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) | 469 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) |
469 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) | 470 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) |
470 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 471 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |