aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFGraphicState.cpp
diff options
context:
space:
mode:
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());