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

Unified Diff: src/pdf/SkPDFGraphicState.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 | « src/pdf/SkPDFFormXObject.cpp ('k') | src/pdf/SkPDFMetadata.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFGraphicState.cpp
diff --git a/src/pdf/SkPDFGraphicState.cpp b/src/pdf/SkPDFGraphicState.cpp
index 121e583487e38d45fa087aaf2c5f6908d3e26dea..7c4c5e30eb4858f3fc3b4ae0e991aa72b1b013d4 100644
--- a/src/pdf/SkPDFGraphicState.cpp
+++ b/src/pdf/SkPDFGraphicState.cpp
@@ -129,7 +129,7 @@ SkPDFGraphicState* SkPDFGraphicState::GetGraphicStateForPaint(
static SkPDFObject* create_invert_function() {
// Acrobat crashes if we use a type 0 function, kpdf crashes if we use
// a type 2 function, so we use a type 4 function.
- sk_sp<SkPDFArray> domainAndRange(new SkPDFArray);
+ auto domainAndRange = sk_make_sp<SkPDFArray>();
domainAndRange->reserve(2);
domainAndRange->appendInt(0);
domainAndRange->appendInt(1);
@@ -139,7 +139,7 @@ static SkPDFObject* create_invert_function() {
sk_sp<SkData> psInvertStream(
SkData::NewWithoutCopy(psInvert, strlen(psInvert)));
- sk_sp<SkPDFStream> invertFunction(new SkPDFStream(psInvertStream.get()));
+ auto invertFunction = sk_make_sp<SkPDFStream>(psInvertStream.get());
invertFunction->insertInt("FunctionType", 4);
invertFunction->insertObject("Domain", SkRef(domainAndRange.get()));
invertFunction->insertObject("Range", domainAndRange.release());
@@ -154,7 +154,7 @@ SkPDFDict* SkPDFGraphicState::GetSMaskGraphicState(SkPDFFormXObject* sMask,
SkPDFSMaskMode sMaskMode) {
// The practical chances of using the same mask more than once are unlikely
// enough that it's not worth canonicalizing.
- sk_sp<SkPDFDict> sMaskDict(new SkPDFDict("Mask"));
+ auto sMaskDict = sk_make_sp<SkPDFDict>("Mask");
if (sMaskMode == kAlpha_SMaskMode) {
sMaskDict->insertName("S", "Alpha");
} else if (sMaskMode == kLuminosity_SMaskMode) {
@@ -165,7 +165,7 @@ SkPDFDict* SkPDFGraphicState::GetSMaskGraphicState(SkPDFFormXObject* sMask,
sMaskDict->insertObjRef("TR", SkRef(invertFunction.get(create_invert_function)));
}
- sk_sp<SkPDFDict> result(new SkPDFDict("ExtGState"));
+ auto result = sk_make_sp<SkPDFDict>("ExtGState");
result->insertObject("SMask", sMaskDict.release());
return result.release();
}
@@ -186,7 +186,7 @@ void SkPDFGraphicState::emitObject(
SkWStream* stream,
const SkPDFObjNumMap& objNumMap,
const SkPDFSubstituteMap& substitutes) const {
- sk_sp<SkPDFDict> dict(new SkPDFDict("ExtGState"));
+ auto dict = sk_make_sp<SkPDFDict>("ExtGState");
dict->insertName("Type", "ExtGState");
SkScalar alpha = SkIntToScalar(fAlpha) / 0xFF;
« no previous file with comments | « src/pdf/SkPDFFormXObject.cpp ('k') | src/pdf/SkPDFMetadata.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698