SkTextBlob

Initial implementation.

R=bungeman@google.com, jbroman@chromium.org, mtklein@google.com, reed@google.com, robertphillips@google.com

Author: fmalita@chromium.org

Review URL: https://codereview.chromium.org/473633002
diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h
index 6ec6e9c..6baabe6 100644
--- a/src/core/SkRecords.h
+++ b/src/core/SkRecords.h
@@ -10,23 +10,22 @@
 
 #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;
-};
+#include "SkTextBlob.h"
 
 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.
 //
@@ -68,6 +67,7 @@
     M(DrawRRect)                                                    \
     M(DrawRect)                                                     \
     M(DrawSprite)                                                   \
+    M(DrawTextBlob)                                                     \
     M(DrawVertices)
 
 // Defines SkRecords::Type, an enum of all record types.
@@ -231,7 +231,7 @@
 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, RefBox<SkPicture>, picture, Optional<SkMatrix>, matrix);
 RECORD4(DrawPoints, SkPaint, paint, SkCanvas::PointMode, mode, size_t, count, SkPoint*, pts);
 RECORD4(DrawPosText, SkPaint, paint,
                      PODArray<char>, text,
@@ -250,6 +250,10 @@
                   size_t, byteLength,
                   SkScalar, x,
                   SkScalar, y);
+RECORD4(DrawTextBlob, SkPaint, paint,
+                      RefBox<SkTextBlob>, blob,
+                      SkScalar, x,
+                      SkScalar, y);
 RECORD5(DrawTextOnPath, SkPaint, paint,
                         PODArray<char>, text,
                         size_t, byteLength,