aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/SkTableColorFilter.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-12-19 13:49:15 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-19 13:49:15 -0800
commitf3f5bad7ded35265c0b5d042cc4174386b197a33 (patch)
treeb8197317dd26d7e5b65f1559446c8d39e8be1457 /src/effects/SkTableColorFilter.cpp
parent290c09b8bbd8d221d363150e2ce87158f4668df0 (diff)
Add toString methods to SkImageFilter-derived classes
This isn't definitive but at least makes something show up in the debugger. Review URL: https://codereview.chromium.org/789163006
Diffstat (limited to 'src/effects/SkTableColorFilter.cpp')
-rw-r--r--src/effects/SkTableColorFilter.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 942bae7d06..e12b3d78ec 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -155,7 +155,32 @@ void SkTable_ColorFilter::filterSpan(const SkPMColor src[], int count,
#ifndef SK_IGNORE_TO_STRING
void SkTable_ColorFilter::toString(SkString* str) const {
- str->append("SkTable_ColorFilter");
+ 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(")");
}
#endif