diff options
Diffstat (limited to 'src/effects/SkTableColorFilter.cpp')
-rw-r--r-- | src/effects/SkTableColorFilter.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index fcf76dcbae..47d6ae2d8c 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -90,6 +90,8 @@ public: GrContext*, const GrColorSpaceInfo&) const override; #endif + void toString(SkString* str) const override; + SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTable_ColorFilter) enum { @@ -138,6 +140,35 @@ private: typedef SkColorFilter INHERITED; }; +void SkTable_ColorFilter::toString(SkString* str) const { + const uint8_t* table = fStorage; + const uint8_t* tableA = gIdentityTable; + const uint8_t* tableR = gIdentityTable; + const uint8_t* tableG = gIdentityTable; + const uint8_t* tableB = gIdentityTable; + if (fFlags & kA_Flag) { + tableA = table; table += 256; + } + if (fFlags & kR_Flag) { + tableR = table; table += 256; + } + if (fFlags & kG_Flag) { + tableG = table; table += 256; + } + if (fFlags & kB_Flag) { + tableB = table; + } + + str->append("SkTable_ColorFilter ("); + + for (int i = 0; i < 256; ++i) { + str->appendf("%d: %d,%d,%d,%d\n", + i, tableR[i], tableG[i], tableB[i], tableA[i]); + } + + str->append(")"); +} + static const uint8_t gCountNibBits[] = { 0, 1, 1, 2, 1, 2, 2, 3, |