aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/SkMultiPictureDocument.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/SkMultiPictureDocument.h')
-rw-r--r--src/utils/SkMultiPictureDocument.h52
1 files changed, 21 insertions, 31 deletions
diff --git a/src/utils/SkMultiPictureDocument.h b/src/utils/SkMultiPictureDocument.h
index ac782606ff..0ca8c2de72 100644
--- a/src/utils/SkMultiPictureDocument.h
+++ b/src/utils/SkMultiPictureDocument.h
@@ -7,42 +7,32 @@
#ifndef SkMultiPictureDocument_DEFINED
#define SkMultiPictureDocument_DEFINED
-/*
- This format is not intended to be used in production.
-
- For clients looking for a way to represent a document in memory,
-
- struct Doc {
- std::vector<sk_sp<SkPicture>> fPages;
- std::vector<SkSize> fPageSizes;
- };
-
- or
-
- struct Page {
- sk_sp<SkPicture> fPage;
- SkSize fPageSize;
- };
- std::vector<Page> pages;
+#include "SkDocument.h"
- would work much better.
+class SkStreamSeekable;
- Multi-SkPicture (MSKP) files are still useful for debugging and
- testing.
+/**
+ * Writes into a file format that is similar to SkPicture::serialize()
+ */
+SK_API sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* dst);
- The downsides of this format are currently:
- - no way to extract a single page; must read the entire file at once.
- - must use `dm` to convert to another format before passing into
- standard skp tools.
- - `dm` can extract the first page to skp, but no others.
+struct SkDocumentPage {
+ sk_sp<SkPicture> fPicture;
+ SkSize fSize;
+};
- TODO(halcanary): replace with somthing that addresses these issues.
+/**
+ * Returns the number of pages in the SkMultiPictureDocument.
*/
+SK_API int SkMultiPictureDocumentReadPageCount(SkStreamSeekable* src);
-#include "SkDocument.h"
-
-/** Writes into an experimental, undocumented file format that is
- useful for debugging documents printed via Skia. */
-SK_API sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* dst);
+/**
+ * Read the SkMultiPictureDocument into the provided array of pages.
+ * dstArrayCount must equal SkMultiPictureDocumentReadPageCount().
+ * Return false on error.
+ */
+SK_API bool SkMultiPictureDocumentRead(SkStreamSeekable* src,
+ SkDocumentPage* dstArray,
+ int dstArrayCount);
#endif // SkMultiPictureDocument_DEFINED