Index: src/core/SkRecords.h |
diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h |
index 6ec6e9ca2e8485674310018e488b347062797d50..0401b274129828453786d15d93b8d252bc390983 100644 |
--- a/src/core/SkRecords.h |
+++ b/src/core/SkRecords.h |
@@ -11,20 +11,6 @@ |
#include "SkCanvas.h" |
#include "SkPicture.h" |
-class SkPictureBox { |
-public: |
- SkPictureBox(const SkPicture* obj) : fObj(SkRef(obj)) {} |
- ~SkPictureBox() { fObj->unref(); } |
- |
- operator const SkPicture*() const { return fObj; } |
- |
-private: |
- SkPictureBox(const SkPictureBox&); |
- SkPictureBox& operator=(const SkPictureBox&); |
- |
- const SkPicture* fObj; |
-}; |
- |
namespace SkRecords { |
// A list of all the types of canvas calls we can record. |
@@ -132,6 +118,18 @@ struct T { \ |
T* operator->() { return ptr; } \ |
const T* operator->() const { return ptr; } |
+template <typename T> |
+class SkTRefBox : SkNoncopyable { |
+public: |
+ SkTRefBox(T* obj) : fObj(SkRef(obj)) {} |
+ ~SkTRefBox() { fObj->unref(); } |
+ |
+ ACT_AS_PTR(fObj); |
+ |
+private: |
+ T* fObj; |
+}; |
+ |
// An Optional doesn't own the pointer's memory, but may need to destroy non-POD data. |
template <typename T> |
class Optional : SkNoncopyable { |
@@ -231,7 +229,9 @@ RECORD2(DrawOval, SkPaint, paint, SkRect, oval); |
RECORD1(DrawPaint, SkPaint, paint); |
RECORD2(DrawPath, SkPaint, paint, SkPath, path); |
//RECORD2(DrawPatch, SkPaint, paint, SkPatch, patch); |
-RECORD3(DrawPicture, Optional<SkPaint>, paint, SkPictureBox, picture, Optional<SkMatrix>, matrix); |
+RECORD3(DrawPicture, Optional<SkPaint>, paint, |
+ SkTRefBox<const SkPicture>, picture, |
+ Optional<SkMatrix>, matrix); |
RECORD4(DrawPoints, SkPaint, paint, SkCanvas::PointMode, mode, size_t, count, SkPoint*, pts); |
RECORD4(DrawPosText, SkPaint, paint, |
PODArray<char>, text, |