diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h index 4c526d229..7a3e7bb7f 100644 --- a/include/pdf/SkPDFDevice.h +++ b/include/pdf/SkPDFDevice.h @@ -123,9 +123,9 @@ public: // PDF specific methods. - /** Returns a reference to the resource dictionary for this device. + /** Returns the resource dictionary for this device. */ - SK_API const SkRefPtr& getResourceDict(); + SK_API SkPDFDict* getResourceDict(); /** Get the list of resources (PDF objects) used on this page. * @param resourceList A list to append the resources to. diff --git a/include/pdf/SkPDFDocument.h b/include/pdf/SkPDFDocument.h index 1a5d8354e..3f171f5f2 100644 --- a/include/pdf/SkPDFDocument.h +++ b/include/pdf/SkPDFDocument.h @@ -60,14 +60,14 @@ public: * @param pageNumber The position to add the passed device (1 based). * @param pdfDevice The page to add to this document. */ - SK_API bool setPage(int pageNumber, const SkRefPtr& pdfDevice); + SK_API bool setPage(int pageNumber, SkPDFDevice* pdfDevice); /** Append the passed pdf device to the document as a new page. Returns * true if successful. Will fail if the document has already been emitted. * * @param pdfDevice The page to add to this document. */ - SK_API bool appendPage(const SkRefPtr& pdfDevice); + SK_API bool appendPage(SkPDFDevice* pdfDevice); /** Get the list of pages in this document. */ diff --git a/include/pdf/SkPDFPage.h b/include/pdf/SkPDFPage.h index 2a0fe166f..a3978744e 100644 --- a/include/pdf/SkPDFPage.h +++ b/include/pdf/SkPDFPage.h @@ -37,7 +37,7 @@ public: * have content on it yet. * @param content The page content. */ - explicit SkPDFPage(const SkRefPtr& content); + explicit SkPDFPage(SkPDFDevice* content); ~SkPDFPage(); /** Before a page and its contents can be sized and emitted, it must diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index caba8226b..619d55d4c 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -983,7 +983,7 @@ void SkPDFDevice::setDrawingArea(DrawingArea drawingArea) { fDrawingArea = drawingArea; } -const SkRefPtr& SkPDFDevice::getResourceDict() { +SkPDFDict* SkPDFDevice::getResourceDict() { if (fResourceDict.get() == NULL) { fResourceDict = new SkPDFDict; fResourceDict->unref(); // SkRefPtr and new both took a reference. @@ -1048,7 +1048,7 @@ const SkRefPtr& SkPDFDevice::getResourceDict() { procSets->appendName(procs[i]); fResourceDict->insert("ProcSet", procSets.get()); } - return fResourceDict; + return fResourceDict.get(); } void SkPDFDevice::getResources(SkTDArray* resourceList) const { diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp index d60512e7a..55aadf407 100644 --- a/src/pdf/SkPDFDocument.cpp +++ b/src/pdf/SkPDFDocument.cpp @@ -165,8 +165,7 @@ bool SkPDFDocument::emitPDF(SkWStream* stream) { return true; } -bool SkPDFDocument::setPage(int pageNumber, - const SkRefPtr& pdfDevice) { +bool SkPDFDocument::setPage(int pageNumber, SkPDFDevice* pdfDevice) { if (fPageTree.count() != 0) { return false; } @@ -188,7 +187,7 @@ bool SkPDFDocument::setPage(int pageNumber, return true; } -bool SkPDFDocument::appendPage(const SkRefPtr& pdfDevice) { +bool SkPDFDocument::appendPage(SkPDFDevice* pdfDevice) { if (fPageTree.count() != 0) { return false; } diff --git a/src/pdf/SkPDFFormXObject.cpp b/src/pdf/SkPDFFormXObject.cpp index 0a75d2a25..57745f8da 100644 --- a/src/pdf/SkPDFFormXObject.cpp +++ b/src/pdf/SkPDFFormXObject.cpp @@ -36,7 +36,7 @@ SkPDFFormXObject::SkPDFFormXObject(SkPDFDevice* device) { insertName("Type", "XObject"); insertName("Subtype", "Form"); insert("BBox", device->getMediaBox().get()); - insert("Resources", device->getResourceDict().get()); + insert("Resources", device->getResourceDict()); // We invert the initial transform and apply that to the xobject so that // it doesn't get applied twice. We can't just undo it because it's diff --git a/src/pdf/SkPDFPage.cpp b/src/pdf/SkPDFPage.cpp index 3823f745d..09849b0ac 100644 --- a/src/pdf/SkPDFPage.cpp +++ b/src/pdf/SkPDFPage.cpp @@ -19,7 +19,7 @@ #include "SkPDFPage.h" #include "SkStream.h" -SkPDFPage::SkPDFPage(const SkRefPtr& content) +SkPDFPage::SkPDFPage(SkPDFDevice* content) : SkPDFDict("Page"), fDevice(content) { } @@ -29,7 +29,7 @@ SkPDFPage::~SkPDFPage() {} void SkPDFPage::finalizePage(SkPDFCatalog* catalog, bool firstPage, SkTDArray* resourceObjects) { if (fContentStream.get() == NULL) { - insert("Resources", fDevice->getResourceDict().get()); + insert("Resources", fDevice->getResourceDict()); insert("MediaBox", fDevice->getMediaBox().get()); SkRefPtr content = fDevice->content(); diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp index ee225173b..17f8b2774 100644 --- a/src/pdf/SkPDFShader.cpp +++ b/src/pdf/SkPDFShader.cpp @@ -707,7 +707,7 @@ SkPDFImageShader::SkPDFImageShader(SkPDFShader::State* state) : fState(state) { insert("BBox", patternBBoxArray.get()); insertScalar("XStep", patternBBox.width()); insertScalar("YStep", patternBBox.height()); - insert("Resources", pattern.getResourceDict().get()); + insert("Resources", pattern.getResourceDict()); insert("Matrix", SkPDFUtils::MatrixToArray(finalMatrix))->unref(); fState.get()->fImage.unlockPixels();