aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-03-24 08:12:55 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-24 08:12:55 -0700
commit547019e1a671b1b30746e69b9647b201500e1504 (patch)
treeb108cd8c1280d0704217d0d37d5f70db0038398d
parent8c24d453a214c16d3b2fcb3478a245d14ac7e1a9 (diff)
SkPDF: clean up extra references
This cleans up code left behind from http://crrev.com/870333002 Review URL: https://codereview.chromium.org/1029263004
-rw-r--r--src/pdf/SkPDFDevice.cpp1
-rw-r--r--src/pdf/SkPDFDocument.cpp1
-rw-r--r--src/pdf/SkPDFResourceDict.cpp1
-rw-r--r--src/pdf/SkPDFResourceDict.h2
-rw-r--r--src/pdf/SkPDFShader.cpp30
-rw-r--r--src/pdf/SkPDFShader.h6
6 files changed, 12 insertions, 29 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index a0ad1343af..72e9135876 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -33,7 +33,6 @@
#include "SkTextFormatParams.h"
#include "SkTemplates.h"
#include "SkTypefacePriv.h"
-#include "SkTSet.h"
#define DPI_FOR_RASTER_SCALE_ONE 72
diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
index 8280551f8a..1807673edc 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -14,7 +14,6 @@
#include "SkPDFPage.h"
#include "SkPDFTypes.h"
#include "SkStream.h"
-#include "SkTSet.h"
static void addResourcesToCatalog(bool firstPage,
SkTSet<SkPDFObject*>* resourceSet,
diff --git a/src/pdf/SkPDFResourceDict.cpp b/src/pdf/SkPDFResourceDict.cpp
index 40fc1d8dc9..69618de714 100644
--- a/src/pdf/SkPDFResourceDict.cpp
+++ b/src/pdf/SkPDFResourceDict.cpp
@@ -72,7 +72,6 @@ SkPDFObject* SkPDFResourceDict::insertResourceAsReference(
SkPDFResourceType type, int key, SkPDFObject* value) {
SkAutoTUnref<SkPDFObjRef> ref(SkNEW_ARGS(SkPDFObjRef, (value)));
insertResource(type, key, ref);
- fResources.add(value);
return value;
}
diff --git a/src/pdf/SkPDFResourceDict.h b/src/pdf/SkPDFResourceDict.h
index fa9bb448c8..551d20bc8c 100644
--- a/src/pdf/SkPDFResourceDict.h
+++ b/src/pdf/SkPDFResourceDict.h
@@ -78,8 +78,6 @@ private:
SkPDFObject* insertResource(SkPDFResourceType type, int key,
SkPDFObject* value);
- SkTSet<SkPDFObject*> fResources;
-
SkTDArray<SkPDFDict*> fTypes;
typedef SkPDFDict INHERITED;
};
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 0b66191953..8fc97da307 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -20,7 +20,6 @@
#include "SkScalar.h"
#include "SkStream.h"
#include "SkTemplates.h"
-#include "SkTSet.h"
#include "SkTypes.h"
static bool inverse_transform_bbox(const SkMatrix& matrix, SkRect* bbox) {
@@ -509,9 +508,7 @@ private:
SkPDFFunctionShader::SkPDFFunctionShader(SkPDFShader::State* state)
: SkPDFDict("Pattern"), fShaderState(state) {}
-SkPDFFunctionShader::~SkPDFFunctionShader() {
- fResources.unrefAll();
-}
+SkPDFFunctionShader::~SkPDFFunctionShader() {}
bool SkPDFFunctionShader::equals(const SkPDFShader::State& state) const {
return state == *fShaderState;
@@ -537,9 +534,7 @@ bool SkPDFImageShader::equals(const SkPDFShader::State& state) const {
return state == *fShaderState;
}
-SkPDFImageShader::~SkPDFImageShader() {
- fResources.unrefAll();
-}
+SkPDFImageShader::~SkPDFImageShader() {}
////////////////////////////////////////////////////////////////////////////////
@@ -599,8 +594,9 @@ static SkPDFResourceDict* get_gradient_resource_dict(
}
static void populate_tiling_pattern_dict(SkPDFDict* pattern,
- SkRect& bbox, SkPDFDict* resources,
- const SkMatrix& matrix) {
+ SkRect& bbox,
+ SkPDFDict* resources,
+ const SkMatrix& matrix) {
const int kTiling_PatternType = 1;
const int kColoredTilingPattern_PaintType = 1;
const int kConstantSpacing_TilingType = 1;
@@ -673,8 +669,8 @@ SkPDFAlphaFunctionShader* SkPDFAlphaFunctionShader::Create(
SkAutoTDelete<SkPDFShader::State> opaqueState(state.CreateOpaqueState());
- SkPDFObject* colorShader =
- get_pdf_shader_by_state(canon, dpi, &opaqueState);
+ SkAutoTUnref<SkPDFObject> colorShader(
+ get_pdf_shader_by_state(canon, dpi, &opaqueState));
if (!colorShader) {
return NULL;
}
@@ -687,17 +683,14 @@ SkPDFAlphaFunctionShader* SkPDFAlphaFunctionShader::Create(
SkPDFAlphaFunctionShader* alphaFunctionShader =
SkNEW_ARGS(SkPDFAlphaFunctionShader, (autoState->detach()));
- alphaFunctionShader->fColorShader.reset(colorShader);
-
- alphaFunctionShader->fResourceDict.reset(get_gradient_resource_dict(
- alphaFunctionShader->fColorShader.get(), alphaGs.get()));
+ SkAutoTUnref<SkPDFResourceDict> resourceDict(
+ get_gradient_resource_dict(colorShader.get(), alphaGs.get()));
SkAutoTDelete<SkStream> colorStream(
create_pattern_fill_content(0, bbox));
alphaFunctionShader->setData(colorStream.get());
- populate_tiling_pattern_dict(alphaFunctionShader, bbox,
- alphaFunctionShader->fResourceDict.get(),
+ populate_tiling_pattern_dict(alphaFunctionShader, bbox, resourceDict.get(),
SkMatrix::I());
canon->addAlphaShader(alphaFunctionShader);
return alphaFunctionShader;
@@ -893,9 +886,6 @@ SkPDFFunctionShader* SkPDFFunctionShader::Create(
SkPDFFunctionShader* pdfFunctionShader =
SkNEW_ARGS(SkPDFFunctionShader, (autoState->detach()));
- pdfFunctionShader->fResources.push(function);
- // Pass ownership to resource list.
-
pdfFunctionShader->insertInt("PatternType", 2);
pdfFunctionShader->insert("Matrix", matrixArray.get());
pdfFunctionShader->insert("Shading", pdfShader.get());
diff --git a/src/pdf/SkPDFShader.h b/src/pdf/SkPDFShader.h
index 4fdbc44cf7..51add585a7 100644
--- a/src/pdf/SkPDFShader.h
+++ b/src/pdf/SkPDFShader.h
@@ -62,7 +62,6 @@ public:
private:
SkAutoTDelete<const SkPDFShader::State> fShaderState;
- SkTDArray<SkPDFObject*> fResources;
SkPDFFunctionShader(SkPDFShader::State*);
typedef SkPDFDict INHERITED;
};
@@ -82,9 +81,8 @@ public:
private:
SkAutoTDelete<const SkPDFShader::State> fShaderState;
- SkAutoTUnref<SkPDFObject> fColorShader;
- SkAutoTUnref<SkPDFResourceDict> fResourceDict;
SkPDFAlphaFunctionShader(SkPDFShader::State*);
+ typedef SkPDFStream INHERITED;
};
class SkPDFImageShader : public SkPDFStream {
@@ -97,8 +95,8 @@ public:
private:
SkAutoTDelete<const SkPDFShader::State> fShaderState;
- SkTSet<SkPDFObject*> fResources;
SkPDFImageShader(SkPDFShader::State*);
+ typedef SkPDFStream INHERITED;
};
#endif