aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-03 19:57:01 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-03 19:57:01 +0000
commitae09f2dc3fb1e8a8db99b214c8a71d0b9613a856 (patch)
tree00800814251bea8b8005c4bf098ffd9dc83ecb43 /include
parent2fc2359aaa8807606854f44a3f38c836a03977cd (diff)
Adds extra debugging to SkPathRef that can optionally be turned on in a release build.
This is pretty hacky but hopefully will be quite short-lived. Review URL: https://codereview.appspot.com/6584074 git-svn-id: http://skia.googlecode.com/svn/trunk@5793 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkPath.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index bf284f1b90..a8320f6079 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -29,6 +29,14 @@ class SkAutoPathBoundsUpdate;
class SkString;
class SkPathRef;
+#ifndef SK_DEBUG_PATH_REF
+ #ifdef SK_DEBUG
+ #define SK_DEBUG_PATH_REF 1
+ #else
+ #define SK_DEBUG_PATH_REF 0
+ #endif
+#endif
+
/** \class SkPath
The SkPath class encapsulates compound (multiple contour) geometric paths
@@ -830,7 +838,31 @@ private:
kSegmentMask_SerializationShift = 0
};
- SkAutoTUnref<SkPathRef> fPathRef;
+#if SK_DEBUG_PATH_REF
+public:
+ /** Debugging wrapper for SkAutoTUnref<SkPathRef> used to track owners (SkPaths)
+ of SkPathRefs */
+ class PathRefDebugRef {
+ public:
+ PathRefDebugRef(SkPath* owner);
+ PathRefDebugRef(SkPathRef* pr, SkPath* owner);
+ ~PathRefDebugRef();
+ void reset(SkPathRef* ref);
+ void swap(PathRefDebugRef* other);
+ SkPathRef* get() const;
+ SkAutoTUnref<SkPathRef>::BlockRefType *operator->() const;
+ operator SkPathRef*();
+ private:
+ SkAutoTUnref<SkPathRef> fPathRef;
+ SkPath* fOwner;
+ };
+
+private:
+ PathRefDebugRef fPathRef;
+#else
+ SkAutoTUnref<SkPathRef> fPathRef;
+#endif
+
mutable SkRect fBounds;
int fLastMoveToIndex;
uint8_t fFillType;