Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Unified Diff: src/pdf/SkPDFShader.cpp

Issue 1029263004: SkPDF: clean up extra references (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-03-23 (Monday) 20:01:49 EDT Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFShader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFShader.cpp
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 0b66191953bcd5fc143133d8cc12b4e3bdabcce2..8fc97da30770153029a1e08fd461adb89e537d9d 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());
« no previous file with comments | « src/pdf/SkPDFShader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698