From 6eb549e8ca3d88d7536859fd5aa3343fc3011f2f Mon Sep 17 00:00:00 2001 From: "vandebo@chromium.org" Date: Fri, 4 Jan 2013 18:11:21 +0000 Subject: Revert "Remove SkRefPtr" - r7021 samplecode/ still needs to be updated. Review URL: https://codereview.appspot.com/7032048 git-svn-id: http://skia.googlecode.com/svn/trunk@7022 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/pdf/SkPDFImage.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/pdf/SkPDFImage.cpp') diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp index 1b93f6e045..429667a5e2 100644 --- a/src/pdf/SkPDFImage.cpp +++ b/src/pdf/SkPDFImage.cpp @@ -305,7 +305,8 @@ SkPDFImage::SkPDFImage(SkStream* imageData, const SkBitmap& bitmap, if (!doingAlpha && alphaOnly) { // For alpha only images, we stretch a single pixel of black for // the color/shape part. - SkAutoTUnref one(new SkPDFInt(1)); + SkRefPtr one = new SkPDFInt(1); + one->unref(); // SkRefPtr and new both took a reference. insert("Width", one.get()); insert("Height", one.get()); } else { @@ -334,12 +335,16 @@ SkPDFImage::SkPDFImage(SkStream* imageData, const SkBitmap& bitmap, insertInt("BitsPerComponent", bitsPerComp); if (config == SkBitmap::kRGB_565_Config) { - SkAutoTUnref zeroVal(new SkPDFInt(0)); - SkAutoTUnref scale5Val( - new SkPDFScalar(SkFloatToScalar(8.2258f))); // 255/2^5-1 - SkAutoTUnref scale6Val( - new SkPDFScalar(SkFloatToScalar(4.0476f))); // 255/2^6-1 - SkAutoTUnref decodeValue(new SkPDFArray()); + SkRefPtr zeroVal = new SkPDFInt(0); + zeroVal->unref(); // SkRefPtr and new both took a reference. + SkRefPtr scale5Val = + new SkPDFScalar(SkFloatToScalar(8.2258f)); // 255/2^5-1 + scale5Val->unref(); // SkRefPtr and new both took a reference. + SkRefPtr scale6Val = + new SkPDFScalar(SkFloatToScalar(4.0476f)); // 255/2^6-1 + scale6Val->unref(); // SkRefPtr and new both took a reference. + SkRefPtr decodeValue = new SkPDFArray(); + decodeValue->unref(); // SkRefPtr and new both took a reference. decodeValue->reserve(6); decodeValue->append(zeroVal.get()); decodeValue->append(scale5Val.get()); -- cgit v1.2.3