SkPDF: PDFStream has-a not is-a PDFDict
Motivation:
SkPDFStream and SkPDFSharedStream now work the same.
Also:
- move SkPDFStream into SkPDFTypes (it's a fundamental PDF type).
- minor refactor of SkPDFSharedStream
- SkPDFSharedStream takes unique_ptr to represent ownership
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2190883003
Review-Url: https://codereview.chromium.org/2190883003
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 612ff87..31af569 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -743,8 +743,9 @@
create_pattern_fill_content(0, bbox));
alphaFunctionShader->setData(std::move(colorStream));
- populate_tiling_pattern_dict(alphaFunctionShader, bbox, resourceDict.get(),
- SkMatrix::I());
+ populate_tiling_pattern_dict(
+ alphaFunctionShader->dict(), bbox, resourceDict.get(),
+ SkMatrix::I());
doc->canon()->addAlphaShader(alphaFunctionShader);
return alphaFunctionShader;
}
@@ -804,9 +805,9 @@
SkPDFArray* domain,
sk_sp<SkPDFObject> range) {
auto result = sk_make_sp<SkPDFStream>(std::move(psCode));
- result->insertInt("FunctionType", 4);
- result->insertObject("Domain", sk_ref_sp(domain));
- result->insertObject("Range", std::move(range));
+ result->dict()->insertInt("FunctionType", 4);
+ result->dict()->insertObject("Domain", sk_ref_sp(domain));
+ result->dict()->insertObject("Range", std::move(range));
return result;
}
@@ -1213,7 +1214,7 @@
imageShader->setData(patternDevice->content());
auto resourceDict = patternDevice->makeResourceDict();
- populate_tiling_pattern_dict(imageShader, patternBBox,
+ populate_tiling_pattern_dict(imageShader->dict(), patternBBox,
resourceDict.get(), finalMatrix);
imageShader->fShaderState->fImage.unlockPixels();