Simplify a little in SkRecords.h:

 - ACT_AS_PTR can just expose const methods to get at the pointers.
   (If the thing stored must stay const, we pass a const T.)
 - DrawPatch works fine with Record# macros, so use Record5.

BUG=skia:
R=fmalita@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/585523003
diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h
index c1c5596..c06d276 100644
--- a/src/core/SkRecords.h
+++ b/src/core/SkRecords.h
@@ -118,17 +118,15 @@
     A a; B b; C c; D d; E e;                                              \
 };
 
-#define ACT_AS_PTR(ptr)                       \
-    operator T*() { return ptr; }             \
-    operator const T*() const { return ptr; } \
-    T* operator->() { return ptr; }           \
-    const T* operator->() const { return ptr; }
+#define ACT_AS_PTR(ptr)                 \
+    operator T*() const { return ptr; } \
+    T* operator->() const { return ptr; }
 
 template <typename T>
 class RefBox : SkNoncopyable {
 public:
-    RefBox(T* obj) : fObj(SkRef(obj)) {}
-    ~RefBox() { fObj->unref(); }
+    RefBox(T* obj) : fObj(SkSafeRef(obj)) {}
+    ~RefBox() { SkSafeUnref(fObj); }
 
     ACT_AS_PTR(fObj);
 
@@ -239,7 +237,6 @@
 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<const SkPicture>, picture,
                      Optional<SkMatrix>, matrix);
@@ -273,6 +270,12 @@
 
 RECORD2(DrawData, PODArray<char>, data, size_t, length);
 
+RECORD5(DrawPatch, SkPaint, paint,
+                   PODArray<SkPoint>, cubics,
+                   PODArray<SkColor>, colors,
+                   PODArray<SkPoint>, texCoords,
+                   RefBox<SkXfermode>, xmode);
+
 // This guy is so ugly we just write it manually.
 struct DrawVertices {
     static const Type kType = DrawVertices_Type;
@@ -307,24 +310,6 @@
     int indexCount;
 };
 
-struct DrawPatch {
-    static const Type kType = DrawPatch_Type;
-
-    DrawPatch(const SkPaint& paint, SkPoint cubics[12], SkColor colors[4],
-              SkPoint texCoords[4], SkXfermode* xmode)
-    : paint(paint)
-    , cubics(cubics)
-    , colors(colors)
-    , texCoords(texCoords)
-    , xmode(SkSafeRef(xmode)) { }
-
-    SkPaint paint;
-    PODArray<SkPoint> cubics;
-    PODArray<SkColor> colors;
-    PODArray<SkPoint> texCoords;
-    SkAutoTUnref<SkXfermode> xmode;
-};
-
 #undef RECORD0
 #undef RECORD1
 #undef RECORD2