SkPDF: SkPDFStream takes only SkStreamAsset
This is possible since https://crrev.com/869763002. Later, I'll clean
up the logic and class constructors. For now, I assert everywhere I
expect a SkStreamAsset to be well-behaved (duplcate, hasLength).
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2098393002
Review-Url: https://codereview.chromium.org/2098393002
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 9a2e4a9..942fe65 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -672,7 +672,7 @@
* @param gsIndex A graphics state resource index to apply, or <0 if no
* graphics state to apply.
*/
-static SkStream* create_pattern_fill_content(int gsIndex, SkRect& bounds) {
+static SkStreamAsset* create_pattern_fill_content(int gsIndex, SkRect& bounds) {
SkDynamicMemoryWStream content;
if (gsIndex >= 0) {
SkPDFUtils::ApplyGraphicState(gsIndex, &content);
@@ -699,7 +699,7 @@
sk_sp<SkPDFObject> luminosityShader(
get_pdf_shader_by_state(doc, dpi, &alphaToLuminosityState));
- std::unique_ptr<SkStream> alphaStream(create_pattern_fill_content(-1, bbox));
+ std::unique_ptr<SkStreamAsset> alphaStream(create_pattern_fill_content(-1, bbox));
auto resources =
get_gradient_resource_dict(luminosityShader.get(), nullptr);
@@ -738,7 +738,7 @@
auto resourceDict =
get_gradient_resource_dict(colorShader.get(), alphaGs.get());
- std::unique_ptr<SkStream> colorStream(
+ std::unique_ptr<SkStreamAsset> colorStream(
create_pattern_fill_content(0, bbox));
alphaFunctionShader->setData(colorStream.get());