SkPDF: refactor streams, experimental threading
All PDF Streams are immediatly serialized, and are never long-lived
in memory.
if EXPERIMENTAL fExecutor is set on the Document, streams are
compressed in parallel.
Results for PDFBigDocBench:
without patch 1807885.01 μs
with patch without executor 1802808.35 μs
with patch with executor 246313.72 μs
SkPDFStreamOut() function replaces SkPDFStream classes.
Page resources are all serialized early.
Several Document-level objects are serialzied early.
SkUUID introduced as top-level object.
Many {insert|append}ObjRef() converted to memory efficient
{insert|append}Ref().
Bug: skia:8630
Change-Id: Ic336917d0c8b9ac1c2423b43bfe9b49a3533fbff
Reviewed-on: https://skia-review.googlesource.com/c/176588
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/src/pdf/SkPDFFormXObject.h b/src/pdf/SkPDFFormXObject.h
index e62b69c..5fa52c9 100644
--- a/src/pdf/SkPDFFormXObject.h
+++ b/src/pdf/SkPDFFormXObject.h
@@ -12,14 +12,17 @@
#include "SkPDFDevice.h"
#include "SkPDFTypes.h"
+class SkPDFDocument;
+
/** A form XObject is a self contained description of a graphics
object. A form XObject is a page object with slightly different
syntax, that can be drawn into a page content stream, just like a
bitmap XObject can be drawn into a page content stream.
*/
-sk_sp<SkPDFObject> SkPDFMakeFormXObject(std::unique_ptr<SkStreamAsset> content,
- sk_sp<SkPDFArray> mediaBox,
- sk_sp<SkPDFDict> resourceDict,
- const SkMatrix& inverseTransform,
- const char* colorSpace);
+SkPDFIndirectReference SkPDFMakeFormXObject(SkPDFDocument* doc,
+ std::unique_ptr<SkStreamAsset> content,
+ sk_sp<SkPDFArray> mediaBox,
+ sk_sp<SkPDFDict> resourceDict,
+ const SkMatrix& inverseTransform,
+ const char* colorSpace);
#endif