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

Unified Diff: src/core/SkRecords.h

Issue 495793002: Our SkPicture::Analysis visitors should recurse into nested pictures. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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/SkPicture.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecords.h
diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h
index 6baabe6b7655de5a8199ae5b32aa5906efc9feef..f3d96d4aa99c2e5e1f76c264bd8097ec313c5874 100644
--- a/src/core/SkRecords.h
+++ b/src/core/SkRecords.h
@@ -14,18 +14,6 @@
namespace SkRecords {
-template <typename T>
-class RefBox : SkNoncopyable {
-public:
- RefBox(const T* obj) : fObj(SkRef(obj)) {}
- ~RefBox() { fObj->unref(); }
-
- operator const T*() const { return fObj; }
-
-private:
- const T* fObj;
-};
-
// A list of all the types of canvas calls we can record.
// Each of these is reified into a struct below.
//
@@ -132,6 +120,18 @@ struct T { \
T* operator->() { return ptr; } \
const T* operator->() const { return ptr; }
+template <typename T>
+class RefBox : SkNoncopyable {
+public:
+ RefBox(T* obj) : fObj(SkRef(obj)) {}
+ ~RefBox() { 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 +231,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, RefBox<SkPicture>, picture, Optional<SkMatrix>, matrix);
+RECORD3(DrawPicture, Optional<SkPaint>, paint,
+ RefBox<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,
@@ -251,7 +253,7 @@ RECORD5(DrawText, SkPaint, paint,
SkScalar, x,
SkScalar, y);
RECORD4(DrawTextBlob, SkPaint, paint,
- RefBox<SkTextBlob>, blob,
+ RefBox<const SkTextBlob>, blob,
SkScalar, x,
SkScalar, y);
RECORD5(DrawTextOnPath, SkPaint, paint,
« no previous file with comments | « src/core/SkPicture.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698