Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: src/utils/SkMultiPictureDocumentReader.h

Issue 2023593002: SkMultiPictureDocument & SkMultiPictureDocumentReader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-06-02 (Thursday) 09:23:50 EDT Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/utils/SkMultiPictureDocumentPriv.h ('k') | src/utils/SkMultiPictureDocumentReader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 SkMultiPictureDocumentReader_DEFINED
8 #define SkMultiPictureDocumentReader_DEFINED
9
10 #include "../private/SkTArray.h"
11 #include "SkPicture.h"
12 #include "SkSize.h"
13 #include "SkStream.h"
14
15 /** A lightweight helper class for reading a Skia MultiPictureDocument. */
16 class SkMultiPictureDocumentReader {
17 public:
18 /** Initialize the MultiPictureDocument. Does not take ownership
19 of the SkStreamSeekable. */
20 bool init(SkStreamSeekable*);
21
22 /** Return to factory settings. */
23 void reset() {
24 fSizes.reset();
25 fOffsets.reset();
26 }
27
28 /** Call this after calling init() */
29 int pageCount() const { return fSizes.count(); }
30
31 /** Deserialize a page from the stream. Call init() first. The
32 SkStreamSeekable doesn't need to be the same object, but
33 should point to the same information as before. */
34 sk_sp<SkPicture> readPage(SkStreamSeekable*, int) const;
35
36 /** Fetch the size of the given page, without deserializing the
37 entire page. */
38 SkSize pageSize(int i) const { return fSizes[i]; }
39
40 private:
41 SkTArray<SkSize> fSizes;
42 SkTArray<size_t> fOffsets;
43 };
44
45 #endif // SkMultiPictureDocumentReader_DEFINED
OLDNEW
« no previous file with comments | « src/utils/SkMultiPictureDocumentPriv.h ('k') | src/utils/SkMultiPictureDocumentReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698