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]); |