halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | #ifndef SkMultiPictureDocument_DEFINED |
| 8 | #define SkMultiPictureDocument_DEFINED |
| 9 | |
halcanary | c966ef9 | 2016-08-23 09:15:04 -0700 | [diff] [blame] | 10 | /* |
| 11 | This format is not intended to be used in production. |
| 12 | |
| 13 | For clients looking for a way to represent a document in memory, |
| 14 | |
| 15 | struct Doc { |
| 16 | std::vector<sk_sp<SkPicture>> fPages; |
| 17 | std::vector<SkSize> fPageSizes; |
| 18 | }; |
| 19 | |
| 20 | or |
| 21 | |
| 22 | struct Page { |
| 23 | sk_sp<SkPicture> fPage; |
| 24 | SkSize fPageSize; |
| 25 | }; |
| 26 | std::vector<Page> pages; |
| 27 | |
| 28 | would work much better. |
| 29 | |
| 30 | Multi-SkPicture (MSKP) files are still useful for debugging and |
| 31 | testing. |
| 32 | |
| 33 | The downsides of this format are currently: |
| 34 | - no way to extract a single page; must read the entire file at once. |
| 35 | - must use `dm` to convert to another format before passing into |
| 36 | standard skp tools. |
| 37 | - `dm` can extract the first page to skp, but no others. |
| 38 | |
| 39 | TODO(halcanary): replace with somthing that addresses these issues. |
| 40 | */ |
| 41 | |
halcanary | 45420a9 | 2016-06-02 12:41:14 -0700 | [diff] [blame] | 42 | #include "SkDocument.h" |
| 43 | |
| 44 | /** Writes into an experimental, undocumented file format that is |
| 45 | useful for debugging documents printed via Skia. */ |
| 46 | SK_API sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* dst); |
| 47 | |
| 48 | #endif // SkMultiPictureDocument_DEFINED |