aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFGraphicState.cpp
diff options
context:
space:
mode:
authorGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-04 19:31:24 +0000
committerGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-04 19:31:24 +0000
commitd96d17b9c113ac694138224249ff2ce643e961dd (patch)
treee4057be1bbc1a448d19dea3ce54136e7c97ed188 /src/pdf/SkPDFGraphicState.cpp
parent4a1362a3c91ae9461a54bf1b04c250b0aa145db4 (diff)
Remove SkRefPtr
(resubmit of https://codereview.appspot.com/7030059/) TBR=junov@google.com Review URL: https://codereview.appspot.com/7030065 git-svn-id: http://skia.googlecode.com/svn/trunk@7030 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pdf/SkPDFGraphicState.cpp')
-rw-r--r--src/pdf/SkPDFGraphicState.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/pdf/SkPDFGraphicState.cpp b/src/pdf/SkPDFGraphicState.cpp
index ec9b0e70b2..c326b3b533 100644
--- a/src/pdf/SkPDFGraphicState.cpp
+++ b/src/pdf/SkPDFGraphicState.cpp
@@ -113,16 +113,14 @@ SkPDFObject* SkPDFGraphicState::GetInvertFunction() {
if (!invertFunction) {
// 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.
- SkRefPtr<SkPDFArray> domainAndRange = new SkPDFArray;
- domainAndRange->unref(); // SkRefPtr and new both took a reference.
+ SkAutoTUnref<SkPDFArray> domainAndRange(new SkPDFArray);
domainAndRange->reserve(2);
domainAndRange->appendInt(0);
domainAndRange->appendInt(1);
static const char psInvert[] = "{1 exch sub}";
- SkRefPtr<SkMemoryStream> psInvertStream =
- new SkMemoryStream(&psInvert, strlen(psInvert), true);
- psInvertStream->unref(); // SkRefPtr and new both took a reference.
+ SkAutoTUnref<SkMemoryStream> psInvertStream(
+ new SkMemoryStream(&psInvert, strlen(psInvert), true));
invertFunction = new SkPDFStream(psInvertStream.get());
invertFunction->insertInt("FunctionType", 4);
@@ -139,8 +137,7 @@ SkPDFGraphicState* SkPDFGraphicState::GetSMaskGraphicState(
// enough that it's not worth canonicalizing.
SkAutoMutexAcquire lock(CanonicalPaintsMutex());
- SkRefPtr<SkPDFDict> sMaskDict = new SkPDFDict("Mask");
- sMaskDict->unref(); // SkRefPtr and new both took a reference.
+ SkAutoTUnref<SkPDFDict> sMaskDict(new SkPDFDict("Mask"));
sMaskDict->insertName("S", "Alpha");
sMaskDict->insert("G", new SkPDFObjRef(sMask))->unref();
@@ -200,9 +197,8 @@ void SkPDFGraphicState::populateDict() {
fPopulated = true;
insertName("Type", "ExtGState");
- SkRefPtr<SkPDFScalar> alpha =
- new SkPDFScalar(SkScalarDiv(fPaint.getAlpha(), 0xFF));
- alpha->unref(); // SkRefPtr and new both took a reference.
+ SkAutoTUnref<SkPDFScalar> alpha(
+ new SkPDFScalar(SkScalarDiv(fPaint.getAlpha(), 0xFF)));
insert("CA", alpha.get());
insert("ca", alpha.get());