change drawPicture in SkRecord to just ref the picture

also fix some int/unsigned/size_t warnings

BUG=skia:
R=mtklein@google.com

Author: reed@google.com

Review URL: https://codereview.chromium.org/449933002
diff --git a/tests/RecorderTest.cpp b/tests/RecorderTest.cpp
index 5fcac4d..1ca9206 100644
--- a/tests/RecorderTest.cpp
+++ b/tests/RecorderTest.cpp
@@ -7,6 +7,7 @@
 
 #include "Test.h"
 
+#include "SkPictureRecorder.h"
 #include "SkRecord.h"
 #include "SkRecorder.h"
 #include "SkRecords.h"
@@ -67,3 +68,25 @@
     }
     REPORTER_ASSERT(r, paint.getShader()->unique());
 }
+
+DEF_TEST(Recorder_RefPictures, r) {
+    SkAutoTUnref<SkPicture> pic;
+
+    {
+        SkPictureRecorder pr;
+        SkCanvas* canvas = pr.beginRecording(100, 100);
+        canvas->drawColor(SK_ColorRED);
+        pic.reset(pr.endRecording());
+    }
+    REPORTER_ASSERT(r, pic->unique());
+
+    {
+        SkRecord record;
+        SkRecorder recorder(&record, 100, 100);
+        recorder.drawPicture(pic);
+        // the recorder should now also be an owner
+        REPORTER_ASSERT(r, !pic->unique());
+    }
+    // the recorder destructor should have released us (back to unique)
+    REPORTER_ASSERT(r, pic->unique());
+}