| Index: src/pdf/SkPDFStream.h
|
| diff --git a/src/pdf/SkPDFStream.h b/src/pdf/SkPDFStream.h
|
| index d29d9b19badc352071c0866173b282d166af8888..c5961d42b1a6b0d45075d6350070206adbdd182c 100644
|
| --- a/src/pdf/SkPDFStream.h
|
| +++ b/src/pdf/SkPDFStream.h
|
| @@ -27,50 +27,38 @@ class SkPDFStream : public SkPDFDict {
|
| public:
|
| /** Create a PDF stream. A Length entry is automatically added to the
|
| * stream dictionary.
|
| - * @param data The data part of the stream. Will be ref()ed.
|
| + * @param data The data part of the stream. Will not take ownership.
|
| */
|
| - explicit SkPDFStream(SkData* data);
|
| + explicit SkPDFStream(SkData* data) { this->setData(data); }
|
|
|
| /** Create a PDF stream. A Length entry is automatically added to the
|
| * stream dictionary.
|
| - * @param stream The data part of the stream. Will be duplicate()d.
|
| + * @param stream The data part of the stream. Will not take ownership.
|
| */
|
| - explicit SkPDFStream(SkStream* stream);
|
| + explicit SkPDFStream(SkStream* stream) { this->setData(stream); }
|
|
|
| virtual ~SkPDFStream();
|
|
|
| // The SkPDFObject interface.
|
| void emitObject(SkWStream* stream,
|
| const SkPDFObjNumMap& objNumMap,
|
| - const SkPDFSubstituteMap& substitutes) override;
|
| + const SkPDFSubstituteMap& substitutes) const override;
|
|
|
| protected:
|
| - enum State {
|
| - kUnused_State, //!< The stream hasn't been requested yet.
|
| - kNoCompression_State, //!< The stream's been requested in an
|
| - // uncompressed form.
|
| - kCompressed_State, //!< The stream's already been compressed.
|
| - };
|
| -
|
| /* Create a PDF stream with no data. The setData method must be called to
|
| * set the data.
|
| */
|
| - SkPDFStream();
|
| + SkPDFStream() {}
|
|
|
| - void setData(SkData* data);
|
| + /** Only call this function once. */
|
| void setData(SkStream* stream);
|
| -
|
| - size_t dataSize() const;
|
| -
|
| - void setState(State state) {
|
| - fState = state;
|
| + void setData(SkData* data) {
|
| + SkMemoryStream memoryStream(data);
|
| + this->setData(&memoryStream);
|
| }
|
|
|
| private:
|
| - // Indicates what form (or if) the stream has been requested.
|
| - State fState;
|
| -
|
| - SkAutoTDelete<SkStreamRewindable> fDataStream;
|
| + SkAutoTDelete<SkStreamRewindable> fCompressedData;
|
|
|
| typedef SkPDFDict INHERITED;
|
| };
|
|
|