aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/SkMultiPictureDocument.h
blob: ac782606ff706a554a10d76fbc113985660db40a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#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;

  would work much better.

  Multi-SkPicture (MSKP) files are still useful for debugging and
  testing.

  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.

  TODO(halcanary): replace with somthing that addresses these issues.
 */

#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);

#endif  // SkMultiPictureDocument_DEFINED