Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1061)

Unified Diff: src/core/SkAAClip.cpp

Issue 450423002: add a simple ascii-art debug thing for AA clips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add a Y compression flag to the aa clip debugger Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkAAClip.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkAAClip.cpp
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp
index 5d21a47a49470e6f2d85845021cbbed3b76b26bb..58a16f3affd7dd628a5fe602fc9372e12fa61dcd 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
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/core/SkAAClip.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698