OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #ifndef SkPDFStream_DEFINED | 9 #ifndef SkPDFStream_DEFINED |
10 #define SkPDFStream_DEFINED | 10 #define SkPDFStream_DEFINED |
(...skipping 16 matching lines...) Expand all Loading... |
27 /** Create a PDF stream. A Length entry is automatically added to the | 27 /** Create a PDF stream. A Length entry is automatically added to the |
28 * stream dictionary. | 28 * stream dictionary. |
29 * @param data The data part of the stream. Will not take ownership. | 29 * @param data The data part of the stream. Will not take ownership. |
30 */ | 30 */ |
31 explicit SkPDFStream(SkData* data) { this->setData(data); } | 31 explicit SkPDFStream(SkData* data) { this->setData(data); } |
32 | 32 |
33 /** Create a PDF stream. A Length entry is automatically added to the | 33 /** Create a PDF stream. A Length entry is automatically added to the |
34 * stream dictionary. | 34 * stream dictionary. |
35 * @param stream The data part of the stream. Will not take ownership. | 35 * @param stream The data part of the stream. Will not take ownership. |
36 */ | 36 */ |
37 explicit SkPDFStream(SkStream* stream) { this->setData(stream); } | 37 explicit SkPDFStream(SkStreamAsset* stream) { this->setData(stream); } |
38 | 38 |
39 virtual ~SkPDFStream(); | 39 virtual ~SkPDFStream(); |
40 | 40 |
41 // The SkPDFObject interface. | 41 // The SkPDFObject interface. |
42 void emitObject(SkWStream* stream, | 42 void emitObject(SkWStream* stream, |
43 const SkPDFObjNumMap& objNumMap, | 43 const SkPDFObjNumMap& objNumMap, |
44 const SkPDFSubstituteMap& substitutes) const override; | 44 const SkPDFSubstituteMap& substitutes) const override; |
45 void drop() override; | 45 void drop() override; |
46 | 46 |
47 protected: | 47 protected: |
48 /* Create a PDF stream with no data. The setData method must be called to | 48 /* Create a PDF stream with no data. The setData method must be called to |
49 * set the data. | 49 * set the data. |
50 */ | 50 */ |
51 SkPDFStream() {} | 51 SkPDFStream() {} |
52 | 52 |
53 /** Only call this function once. */ | 53 /** Only call this function once. */ |
54 void setData(SkStream* stream); | 54 void setData(SkStreamAsset* stream); |
55 void setData(SkData* data) { | 55 void setData(SkData* data) { |
56 SkMemoryStream memoryStream(data); | 56 SkMemoryStream memoryStream(data); |
57 this->setData(&memoryStream); | 57 this->setData(&memoryStream); |
58 } | 58 } |
59 | 59 |
60 private: | 60 private: |
61 std::unique_ptr<SkStreamRewindable> fCompressedData; | 61 std::unique_ptr<SkStreamAsset> fCompressedData; |
62 | 62 |
63 typedef SkPDFDict INHERITED; | 63 typedef SkPDFDict INHERITED; |
64 }; | 64 }; |
65 | 65 |
66 #endif | 66 #endif |
OLD | NEW |