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

Unified Diff: src/pdf/SkPDFGraphicState.cpp

Issue 1775143002: Revert of SkPDF: Add sk_sp setters; .release() becomes std::move() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/SkPDFResourceDict.h » ('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 19e9a36d05ca52520787a00e5dfa310b99e22f32..7c4c5e30eb4858f3fc3b4ae0e991aa72b1b013d4 100644
--- a/src/pdf/SkPDFGraphicState.cpp
+++ b/src/pdf/SkPDFGraphicState.cpp
@@ -126,7 +126,7 @@
return pdfGraphicState;
}
-static SkPDFStream* create_invert_function() {
+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.
auto domainAndRange = sk_make_sp<SkPDFArray>();
@@ -141,17 +141,12 @@
auto invertFunction = sk_make_sp<SkPDFStream>(psInvertStream.get());
invertFunction->insertInt("FunctionType", 4);
- invertFunction->insertObject("Domain", domainAndRange);
- invertFunction->insertObject("Range", std::move(domainAndRange));
+ invertFunction->insertObject("Domain", SkRef(domainAndRange.get()));
+ invertFunction->insertObject("Range", domainAndRange.release());
return invertFunction.release();
}
-SK_DECLARE_STATIC_ONCE_PTR(SkPDFStream, invertFunction);
-
-static sk_sp<SkPDFStream> make_invert_function() {
- return sk_sp<SkPDFStream>(
- SkRef(invertFunction.get(create_invert_function)));
-}
+SK_DECLARE_STATIC_ONCE_PTR(SkPDFObject, invertFunction);
// static
SkPDFDict* SkPDFGraphicState::GetSMaskGraphicState(SkPDFFormXObject* sMask,
@@ -165,13 +160,13 @@
} else if (sMaskMode == kLuminosity_SMaskMode) {
sMaskDict->insertName("S", "Luminosity");
}
- sMaskDict->insertObjRef("G", sk_sp<SkPDFFormXObject>(SkRef(sMask)));
+ sMaskDict->insertObjRef("G", SkRef(sMask));
if (invert) {
- sMaskDict->insertObjRef("TR", make_invert_function());
+ sMaskDict->insertObjRef("TR", SkRef(invertFunction.get(create_invert_function)));
}
auto result = sk_make_sp<SkPDFDict>("ExtGState");
- result->insertObject("SMask", std::move(sMaskDict));
+ result->insertObject("SMask", sMaskDict.release());
return result.release();
}
« no previous file with comments | « src/pdf/SkPDFFormXObject.cpp ('k') | src/pdf/SkPDFResourceDict.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698