Chromium Code Reviews| Index: src/pdf/SkPDFBitmap.cpp |
| diff --git a/src/pdf/SkPDFBitmap.cpp b/src/pdf/SkPDFBitmap.cpp |
| index 1e2e26aa71131feb0b883c028aee5654600687fa..a1b5fcbc9d2f469b903b5a6d2af125aedf1a0a2f 100644 |
| --- a/src/pdf/SkPDFBitmap.cpp |
| +++ b/src/pdf/SkPDFBitmap.cpp |
| @@ -297,8 +297,8 @@ static void bitmap_alpha_to_a8(const SkBitmap& bitmap, SkWStream* out) { |
| } |
| } |
| -static SkPDFArray* make_indexed_color_space(const SkColorTable* table) { |
| - SkPDFArray* result = new SkPDFArray; |
| +static sk_sp<SkPDFArray> make_indexed_color_space(const SkColorTable* table) { |
| + auto result = sk_make_sp<SkPDFArray>(); |
| result->reserve(4); |
| result->appendName("Indexed"); |
| result->appendName("DeviceRGB"); |
| @@ -308,7 +308,7 @@ static SkPDFArray* make_indexed_color_space(const SkColorTable* table) { |
| char shortTableArray[3] = {0, 0, 0}; |
| SkString tableString(shortTableArray, SK_ARRAY_COUNT(shortTableArray)); |
| result->appendString(tableString); |
| - return result; |
| + return std::move(result); |
| } |
| result->appendInt(table->count() - 1); // maximum color index. |
| @@ -324,13 +324,13 @@ static SkPDFArray* make_indexed_color_space(const SkColorTable* table) { |
| } |
| SkString tableString(tableArray, 3 * table->count()); |
| result->appendString(tableString); |
| - return result; |
| + return std::move(result); |
| } |
| static void emit_image_xobject(SkWStream* stream, |
| const SkImage* image, |
| bool alpha, |
| - SkPDFObject* smask, |
| + const sk_sp<SkPDFObject>& smask, |
| const SkPDFObjNumMap& objNumMap, |
| const SkPDFSubstituteMap& substitutes) { |
| SkBitmap bitmap; |
| @@ -364,7 +364,7 @@ static void emit_image_xobject(SkWStream* stream, |
| pdfDict.insertName("ColorSpace", "DeviceRGB"); |
| } |
| if (smask) { |
| - pdfDict.insertObjRef("SMask", SkRef(smask)); |
| + pdfDict.insertObjRef("SMask", smask); // copy ref |
|
bungeman-skia
2016/03/08 19:05:44
Same here.
hal.canary
2016/03/08 19:12:51
Done.
|
| } |
| pdfDict.insertInt("BitsPerComponent", 8); |
| pdfDict.insertName("Filter", "FlateDecode"); |
| @@ -404,7 +404,7 @@ public: |
| void emitObject(SkWStream* stream, |
| const SkPDFObjNumMap& objNumMap, |
| const SkPDFSubstituteMap& subs) const override { |
| - emit_image_xobject(stream, fImage.get(), false, fSMask.get(), objNumMap, subs); |
| + emit_image_xobject(stream, fImage.get(), false, fSMask, objNumMap, subs); |
| } |
| void addResources(SkPDFObjNumMap* catalog, |
| const SkPDFSubstituteMap& subs) const override { |