begin to skiafy PDF headers : removing use of SkRefPtr
Review URL: https://codereview.appspot.com/6526050

git-svn-id: http://skia.googlecode.com/svn/trunk@5596 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 7b774b7..9906d5b 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -546,6 +546,7 @@
 }
 
 void SkPDFDevice::init() {
+    fAnnotations = NULL;
     fResourceDict = NULL;
     fContentEntries.reset();
     fLastContentEntry = NULL;
@@ -562,6 +563,8 @@
     fXObjectResources.unrefAll();
     fFontResources.unrefAll();
     fShaderResources.unrefAll();
+    SkSafeUnref(fAnnotations);
+
     if (clearFontUsage) {
         fFontGlyphUsage->reset();
     }
@@ -1103,12 +1106,11 @@
     return fFontResources;
 }
 
-SkRefPtr<SkPDFArray> SkPDFDevice::getMediaBox() const {
-    SkRefPtr<SkPDFInt> zero = new SkPDFInt(0);
-    zero->unref();  // SkRefPtr and new both took a reference.
+SkPDFArray* SkPDFDevice::copyMediaBox() const {
+    // should this be a singleton?
+    SkAutoTUnref<SkPDFInt> zero(SkNEW_ARGS(SkPDFInt, (0)));
 
-    SkRefPtr<SkPDFArray> mediaBox = new SkPDFArray();
-    mediaBox->unref();  // SkRefPtr and new both took a reference.
+    SkPDFArray* mediaBox = SkNEW(SkPDFArray);
     mediaBox->reserve(4);
     mediaBox->append(zero.get());
     mediaBox->append(zero.get());
@@ -1117,10 +1119,6 @@
     return mediaBox;
 }
 
-SkRefPtr<SkPDFArray> SkPDFDevice::getAnnotations() const {
-    return SkRefPtr<SkPDFArray>(fAnnotations);
-}
-
 SkStream* SkPDFDevice::content() const {
     SkMemoryStream* result = new SkMemoryStream;
     result->setData(this->copyContentToData())->unref();
@@ -1196,9 +1194,8 @@
     SkRect translatedRect;
     transform.mapRect(&translatedRect, r);
 
-    if (fAnnotations.get() == NULL) {
-        fAnnotations = new SkPDFArray;
-        fAnnotations->unref();  // Both new and SkRefPtr took a reference.
+    if (NULL == fAnnotations) {
+        fAnnotations = SkNEW(SkPDFArray);
     }
     SkAutoTUnref<SkPDFDict> annotation(new SkPDFDict("Annot"));
     annotation->insertName("Subtype", "Link");