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

Unified Diff: src/core/SkClipStack.cpp

Issue 311263015: Add dump() to SkClipStack to help with debugging. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add \n. Created 6 years, 6 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 | « include/core/SkRegion.h ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkClipStack.cpp
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index d087592b173c3fbaaacc5441075b283929a26813..a965b1bae7b4cadf20d28892936119d0e0d0c634 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -845,3 +845,63 @@ int32_t SkClipStack::getTopmostGenID() const {
return back->getGenID();
}
+
+#ifdef SK_DEVELOPER
+void SkClipStack::Element::dump() const {
+ static const char* kTypeStrings[] = {
+ "empty",
+ "rect",
+ "rrect",
+ "path"
+ };
+ SK_COMPILE_ASSERT(0 == kEmpty_Type, type_str);
+ SK_COMPILE_ASSERT(1 == kRect_Type, type_str);
+ SK_COMPILE_ASSERT(2 == kRRect_Type, type_str);
+ SK_COMPILE_ASSERT(3 == kPath_Type, type_str);
+ SK_COMPILE_ASSERT(SK_ARRAY_COUNT(kTypeStrings) == kTypeCnt, type_str);
+
+ static const char* kOpStrings[] = {
+ "difference",
+ "intersect",
+ "union",
+ "xor",
+ "reverse-difference",
+ "replace",
+ };
+ SK_COMPILE_ASSERT(0 == SkRegion::kDifference_Op, op_str);
+ SK_COMPILE_ASSERT(1 == SkRegion::kIntersect_Op, op_str);
+ SK_COMPILE_ASSERT(2 == SkRegion::kUnion_Op, op_str);
+ SK_COMPILE_ASSERT(3 == SkRegion::kXOR_Op, op_str);
+ SK_COMPILE_ASSERT(4 == SkRegion::kReverseDifference_Op, op_str);
+ SK_COMPILE_ASSERT(5 == SkRegion::kReplace_Op, op_str);
+ SK_COMPILE_ASSERT(SK_ARRAY_COUNT(kOpStrings) == SkRegion::kOpCnt, op_str);
+
+ SkDebugf("Type: %s, Op: %s, AA: %s, Save Count: %d\n", kTypeStrings[fType],
+ kOpStrings[fOp], (fDoAA ? "yes" : "no"), fSaveCount);
+ switch (fType) {
+ case kEmpty_Type:
+ SkDebugf("\n");
+ break;
+ case kRect_Type:
+ this->getRect().dump();
+ SkDebugf("\n");
+ break;
+ case kRRect_Type:
+ this->getRRect().dump();
+ SkDebugf("\n");
+ break;
+ case kPath_Type:
+ this->getPath().dump(true);
+ break;
+ }
+}
+
+void SkClipStack::dump() const {
+ B2TIter iter(*this);
+ const Element* e;
+ while ((e = iter.next())) {
+ e->dump();
+ SkDebugf("\n");
+ }
+}
+#endif
« no previous file with comments | « include/core/SkRegion.h ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698