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 21 matching lines...) Expand all Loading... |
32 explicit SkPDFStream(SkData* data); | 32 explicit SkPDFStream(SkData* data); |
33 | 33 |
34 /** Create a PDF stream. A Length entry is automatically added to the | 34 /** Create a PDF stream. A Length entry is automatically added to the |
35 * stream dictionary. | 35 * stream dictionary. |
36 * @param stream The data part of the stream. Will be duplicate()d. | 36 * @param stream The data part of the stream. Will be duplicate()d. |
37 */ | 37 */ |
38 explicit SkPDFStream(SkStream* stream); | 38 explicit SkPDFStream(SkStream* stream); |
39 | 39 |
40 virtual ~SkPDFStream(); | 40 virtual ~SkPDFStream(); |
41 | 41 |
42 // The SkPDFObject interface. This two method uses a mutex to | 42 // The SkPDFObject interface. |
43 // allow multiple threads to call at the same time. | |
44 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRID
E; | 43 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRID
E; |
45 | 44 |
46 protected: | 45 protected: |
47 enum State { | 46 enum State { |
48 kUnused_State, //!< The stream hasn't been requested yet. | 47 kUnused_State, //!< The stream hasn't been requested yet. |
49 kNoCompression_State, //!< The stream's been requested in an | 48 kNoCompression_State, //!< The stream's been requested in an |
50 // uncompressed form. | 49 // uncompressed form. |
51 kCompressed_State, //!< The stream's already been compressed. | 50 kCompressed_State, //!< The stream's already been compressed. |
52 }; | 51 }; |
53 | 52 |
(...skipping 29 matching lines...) Expand all Loading... |
83 } | 82 } |
84 | 83 |
85 State getState() const { | 84 State getState() const { |
86 return fState; | 85 return fState; |
87 } | 86 } |
88 | 87 |
89 private: | 88 private: |
90 // Indicates what form (or if) the stream has been requested. | 89 // Indicates what form (or if) the stream has been requested. |
91 State fState; | 90 State fState; |
92 | 91 |
93 // Mutex guards fState, fDataStream, and fSubstitute in public interface. | |
94 SkMutex fMutex; | |
95 | |
96 SkAutoTDelete<SkStreamRewindable> fDataStream; | 92 SkAutoTDelete<SkStreamRewindable> fDataStream; |
97 SkAutoTUnref<SkPDFStream> fSubstitute; | 93 SkAutoTUnref<SkPDFStream> fSubstitute; |
98 | 94 |
99 typedef SkPDFDict INHERITED; | 95 typedef SkPDFDict INHERITED; |
100 }; | 96 }; |
101 | 97 |
102 #endif | 98 #endif |
OLD | NEW |