Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Unified Diff: src/doc/SkDocument_PDF.cpp

Issue 1773033002: SkPDF: use sk_make_sp<T> when it makes sense. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-03-08 (Tuesday) 06:54:33 EST Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/doc/SkDocument_PDF.cpp
diff --git a/src/doc/SkDocument_PDF.cpp b/src/doc/SkDocument_PDF.cpp
index 54e0fe0c5f2ff93ed1cadb511e8056bf1b8631fd..7e5e1a8ebaafc2ba0dec1d314939687d0fe04a9c 100644
--- a/src/doc/SkDocument_PDF.cpp
+++ b/src/doc/SkDocument_PDF.cpp
@@ -77,10 +77,10 @@ static SkPDFObject* create_pdf_page_content(const SkPDFDevice* pageDevice) {
}
static SkPDFDict* create_pdf_page(const SkPDFDevice* pageDevice) {
- sk_sp<SkPDFDict> page(new SkPDFDict("Page"));
+ auto page = sk_make_sp<SkPDFDict>("Page");
page->insertObject("Resources", pageDevice->createResourceDict());
page->insertObject("MediaBox", pageDevice->copyMediaBox());
- sk_sp<SkPDFArray> annotations(new SkPDFArray);
+ auto annotations = sk_make_sp<SkPDFArray>();
pageDevice->appendAnnotations(annotations.get());
if (annotations->size() > 0) {
page->insertObject("Annots", annotations.release());
@@ -121,8 +121,8 @@ static void generate_page_tree(const SkTDArray<SkPDFDict*>& pages,
break;
}
- sk_sp<SkPDFDict> newNode(new SkPDFDict("Pages"));
- sk_sp<SkPDFArray> kids(new SkPDFArray);
+ auto newNode = sk_make_sp<SkPDFDict>("Pages");
+ auto kids = sk_make_sp<SkPDFArray>();
kids->reserve(kNodeSize);
int count = 0;
@@ -174,7 +174,7 @@ static bool emit_pdf_document(const SkTDArray<const SkPDFDevice*>& pageDevices,
}
SkTDArray<SkPDFDict*> pages;
- sk_sp<SkPDFDict> dests(new SkPDFDict);
+ auto dests = sk_make_sp<SkPDFDict>();
for (int i = 0; i < pageDevices.count(); i++) {
SkASSERT(pageDevices[i]);
@@ -185,7 +185,7 @@ static bool emit_pdf_document(const SkTDArray<const SkPDFDevice*>& pageDevices,
pages.push(page.release());
}
- sk_sp<SkPDFDict> docCatalog(new SkPDFDict("Catalog"));
+ auto docCatalog = sk_make_sp<SkPDFDict>("Catalog");
sk_sp<SkPDFObject> infoDict(
metadata.createDocumentInformationDict());
@@ -203,12 +203,12 @@ static bool emit_pdf_document(const SkTDArray<const SkPDFDevice*>& pageDevices,
docCatalog->insertObjRef("Metadata", xmp.release());
// sRGB is specified by HTML, CSS, and SVG.
- sk_sp<SkPDFDict> outputIntent(new SkPDFDict("OutputIntent"));
+ auto outputIntent = sk_make_sp<SkPDFDict>("OutputIntent");
outputIntent->insertName("S", "GTS_PDFA1");
outputIntent->insertString("RegistryName", "http://www.color.org");
outputIntent->insertString("OutputConditionIdentifier",
"sRGB IEC61966-2.1");
- sk_sp<SkPDFArray> intentArray(new SkPDFArray);
+ auto intentArray = sk_make_sp<SkPDFArray>();
intentArray->appendObject(outputIntent.release());
// Don't specify OutputIntents if we are not in PDF/A mode since
// no one has ever asked for this feature.
« no previous file with comments | « no previous file | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698