| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkPDFStream_DEFINED | 10 #ifndef SkPDFStream_DEFINED |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) override; | 43 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) override; |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 enum State { | 46 enum State { |
| 47 kUnused_State, //!< The stream hasn't been requested yet. | 47 kUnused_State, //!< The stream hasn't been requested yet. |
| 48 kNoCompression_State, //!< The stream's been requested in an | 48 kNoCompression_State, //!< The stream's been requested in an |
| 49 // uncompressed form. | 49 // uncompressed form. |
| 50 kCompressed_State, //!< The stream's already been compressed. | 50 kCompressed_State, //!< The stream's already been compressed. |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 /** Create a PDF stream with the same content and dictionary entries | |
| 54 * as the passed one. | |
| 55 */ | |
| 56 explicit SkPDFStream(const SkPDFStream& pdfStream); | |
| 57 | |
| 58 /* Create a PDF stream with no data. The setData method must be called to | 53 /* Create a PDF stream with no data. The setData method must be called to |
| 59 * set the data. | 54 * set the data. |
| 60 */ | 55 */ |
| 61 SkPDFStream(); | 56 SkPDFStream(); |
| 62 | 57 |
| 63 // Populate the stream dictionary. This method returns false if | 58 // Populate the stream dictionary. This method returns false if |
| 64 // fSubstitute should be used. | 59 // fSubstitute should be used. |
| 65 virtual bool populate(SkPDFCatalog* catalog); | 60 virtual bool populate(SkPDFCatalog* catalog); |
| 66 | 61 |
| 67 void setSubstitute(SkPDFStream* stream) { | |
| 68 fSubstitute.reset(stream); | |
| 69 } | |
| 70 | |
| 71 SkPDFStream* getSubstitute() const { | |
| 72 return fSubstitute.get(); | |
| 73 } | |
| 74 | |
| 75 void setData(SkData* data); | 62 void setData(SkData* data); |
| 76 void setData(SkStream* stream); | 63 void setData(SkStream* stream); |
| 77 | 64 |
| 78 size_t dataSize() const; | 65 size_t dataSize() const; |
| 79 | 66 |
| 80 void setState(State state) { | 67 void setState(State state) { |
| 81 fState = state; | 68 fState = state; |
| 82 } | 69 } |
| 83 | 70 |
| 84 State getState() const { | |
| 85 return fState; | |
| 86 } | |
| 87 | |
| 88 private: | 71 private: |
| 89 // Indicates what form (or if) the stream has been requested. | 72 // Indicates what form (or if) the stream has been requested. |
| 90 State fState; | 73 State fState; |
| 91 | 74 |
| 92 SkAutoTDelete<SkStreamRewindable> fDataStream; | 75 SkAutoTDelete<SkStreamRewindable> fDataStream; |
| 93 SkAutoTUnref<SkPDFStream> fSubstitute; | |
| 94 | 76 |
| 95 typedef SkPDFDict INHERITED; | 77 typedef SkPDFDict INHERITED; |
| 96 }; | 78 }; |
| 97 | 79 |
| 98 #endif | 80 #endif |
| OLD | NEW |