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

Unified Diff: src/pdf/SkPDFShader.cpp

Issue 1068343003: SkPDF: ResourceDict replaced by factory function (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-04-08 (Wednesday) 17:35:39 EDT Created 5 years, 8 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 596bbc7d2c6ea7b4802ad3506367f973badff942..be9798f850315a073ddb655d1900086af28597a7 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -575,21 +575,18 @@ SkPDFObject* SkPDFShader::GetPDFShader(SkPDFCanon* canon,
return get_pdf_shader_by_state(canon, dpi, &state);
}
-static SkPDFResourceDict* get_gradient_resource_dict(
+static SkPDFDict* get_gradient_resource_dict(
SkPDFObject* functionShader,
SkPDFObject* gState) {
- SkPDFResourceDict* dict = new SkPDFResourceDict();
-
- if (functionShader != NULL) {
- dict->insertResourceAsReference(
- SkPDFResourceDict::kPattern_ResourceType, 0, functionShader);
+ SkTDArray<SkPDFObject*> patterns;
+ if (functionShader) {
+ patterns.push(functionShader);
}
- if (gState != NULL) {
- dict->insertResourceAsReference(
- SkPDFResourceDict::kExtGState_ResourceType, 0, gState);
+ SkTDArray<SkPDFObject*> graphicStates;
+ if (gState) {
+ graphicStates.push(gState);
}
-
- return dict;
+ return SkPDFResourceDict::Create(&graphicStates, &patterns, NULL, NULL);
}
static void populate_tiling_pattern_dict(SkPDFDict* pattern,
@@ -647,7 +644,7 @@ static SkPDFObject* create_smask_graphic_state(
SkAutoTDelete<SkStream> alphaStream(create_pattern_fill_content(-1, bbox));
- SkAutoTUnref<SkPDFResourceDict>
+ SkAutoTUnref<SkPDFDict>
resources(get_gradient_resource_dict(luminosityShader, NULL));
SkAutoTUnref<SkPDFFormXObject> alphaMask(
@@ -682,7 +679,7 @@ SkPDFAlphaFunctionShader* SkPDFAlphaFunctionShader::Create(
SkPDFAlphaFunctionShader* alphaFunctionShader =
SkNEW_ARGS(SkPDFAlphaFunctionShader, (autoState->detach()));
- SkAutoTUnref<SkPDFResourceDict> resourceDict(
+ SkAutoTUnref<SkPDFDict> resourceDict(
get_gradient_resource_dict(colorShader.get(), alphaGs.get()));
SkAutoTDelete<SkStream> colorStream(
@@ -1100,7 +1097,7 @@ SkPDFImageShader* SkPDFImageShader::Create(
SkNEW_ARGS(SkPDFImageShader, (autoState->detach()));
imageShader->setData(content.get());
- SkAutoTUnref<SkPDFResourceDict> resourceDict(
+ SkAutoTUnref<SkPDFDict> resourceDict(
patternDevice->createResourceDict());
populate_tiling_pattern_dict(imageShader, patternBBox,
resourceDict.get(), finalMatrix);
« 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