SkPDF: use sk_make_sp<T> when it makes sense.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1773033002
Review URL: https://codereview.chromium.org/1773033002
diff --git a/src/doc/SkDocument_PDF.cpp b/src/doc/SkDocument_PDF.cpp
index 54e0fe0..7e5e1a8 100644
--- a/src/doc/SkDocument_PDF.cpp
+++ b/src/doc/SkDocument_PDF.cpp
@@ -77,10 +77,10 @@
}
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 @@
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 @@
}
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 @@
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 @@
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.