diff options
author | humper <humper@google.com> | 2014-08-08 11:45:46 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-08 11:45:46 -0700 |
commit | 6d42d9c7ff1c3d7ab4de032d5451aed02f746c43 (patch) | |
tree | e2d80b67baafd02656f1e770dde25e46dee2b3d1 /src/core/SkAAClip.cpp | |
parent | a50b8f0ec0db079e2886e25fea046fba4082fcef (diff) |
add a simple ascii-art debug thing for AA clips
BUG=skia:
R=reed@google.com
Author: humper@google.com
Review URL: https://codereview.chromium.org/450423002
Diffstat (limited to 'src/core/SkAAClip.cpp')
-rw-r--r-- | src/core/SkAAClip.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp index 5d21a47a49..58a16f3aff 100644 --- a/src/core/SkAAClip.cpp +++ b/src/core/SkAAClip.cpp @@ -219,6 +219,46 @@ void SkAAClip::validate() const { --yoff; SkASSERT(yoff->fY == lastY); } + +static void dump_one_row(const uint8_t* SK_RESTRICT row, + int width, int leading_num) { + if (leading_num) { + SkDebugf( "%03d ", leading_num ); + } + while (width > 0) { + int n = row[0]; + int val = row[1]; + char out = '.'; + if (val == 0xff) { + out = '*'; + } else if (val > 0) { + out = '+'; + } + for (int i = 0 ; i < n ; i++) { + SkDebugf( "%c", out ); + } + row += 2; + width -= n; + } + SkDebugf( "\n" ); +} + +void SkAAClip::debug(bool compress_y) const { + Iter iter(*this); + const int width = fBounds.width(); + + int y = fBounds.fTop; + while (!iter.done()) { + if (compress_y) { + dump_one_row(iter.data(), width, iter.bottom() - iter.top() + 1); + } else { + do { + dump_one_row(iter.data(), width, 0); + } while (++y < iter.bottom()); + } + iter.next(); + } +} #endif /////////////////////////////////////////////////////////////////////////////// |