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

Unified Diff: src/pdf/SkPDFUtils.cpp

Issue 1775043002: SkPDF: Add sk_sp setters; .release() becomes std::move() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix -Wpessimizing-move 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/SkPDFUtils.h ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFUtils.cpp
diff --git a/src/pdf/SkPDFUtils.cpp b/src/pdf/SkPDFUtils.cpp
index 30d6ee7d68899b7f3415352abb668d1966c432fb..f305765389685625d3bc7d5a8310077d129f1bc6 100644
--- a/src/pdf/SkPDFUtils.cpp
+++ b/src/pdf/SkPDFUtils.cpp
@@ -18,9 +18,8 @@
#include <cmath>
-//static
-SkPDFArray* SkPDFUtils::RectToArray(const SkRect& rect) {
- SkPDFArray* result = new SkPDFArray();
+sk_sp<SkPDFArray> SkPDFUtils::RectToArray(const SkRect& rect) {
+ auto result = sk_make_sp<SkPDFArray>();
result->reserve(4);
result->appendScalar(rect.fLeft);
result->appendScalar(rect.fTop);
@@ -29,14 +28,13 @@ SkPDFArray* SkPDFUtils::RectToArray(const SkRect& rect) {
return result;
}
-// static
-SkPDFArray* SkPDFUtils::MatrixToArray(const SkMatrix& matrix) {
+sk_sp<SkPDFArray> SkPDFUtils::MatrixToArray(const SkMatrix& matrix) {
SkScalar values[6];
if (!matrix.asAffine(values)) {
SkMatrix::SetAffineIdentity(values);
}
- SkPDFArray* result = new SkPDFArray;
+ auto result = sk_make_sp<SkPDFArray>();
result->reserve(6);
for (size_t i = 0; i < SK_ARRAY_COUNT(values); i++) {
result->appendScalar(values[i]);
« no previous file with comments | « src/pdf/SkPDFUtils.h ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698