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

Side by Side Diff: src/pdf/SkPDFStream.h

Issue 2190883003: SkPDF: PDFStream has-a not is-a PDFDict (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-07-29 (Friday) 12:30:20 EDT Created 4 years, 4 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/pdf/SkPDFShader.cpp ('k') | src/pdf/SkPDFStream.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 2010 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
8
9 #ifndef SkPDFStream_DEFINED
10 #define SkPDFStream_DEFINED
11
12 #include "SkPDFTypes.h"
13 #include "SkStream.h"
14
15 /** \class SkPDFStream
16
17 A stream object in a PDF. Note, all streams must be indirect objects (via
18 SkObjRef).
19 */
20 class SkPDFStream : public SkPDFDict {
21
22 public:
23 /** Create a PDF stream. A Length entry is automatically added to the
24 * stream dictionary.
25 * @param data The data part of the stream. */
26 explicit SkPDFStream(sk_sp<SkData> data) {
27 this->setData(std::unique_ptr<SkStreamAsset>(
28 new SkMemoryStream(std::move(data))));
29 }
30
31 /** Create a PDF stream. A Length entry is automatically added to the
32 * stream dictionary.
33 * @param stream The data part of the stream.
34 */
35 explicit SkPDFStream(std::unique_ptr<SkStreamAsset> stream) {
36 this->setData(std::move(stream));
37 }
38
39 virtual ~SkPDFStream();
40
41 // The SkPDFObject interface.
42 void emitObject(SkWStream* stream,
43 const SkPDFObjNumMap& objNumMap,
44 const SkPDFSubstituteMap& substitutes) const override;
45 void drop() override;
46
47 protected:
48 /* Create a PDF stream with no data. The setData method must be called to
49 * set the data.
50 */
51 SkPDFStream() {}
52
53 /** Only call this function once. */
54 void setData(std::unique_ptr<SkStreamAsset> stream);
55
56 private:
57 std::unique_ptr<SkStreamAsset> fCompressedData;
58
59 typedef SkPDFDict INHERITED;
60 };
61
62 #endif
OLDNEW
« no previous file with comments | « src/pdf/SkPDFShader.cpp ('k') | src/pdf/SkPDFStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698