OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #ifndef SkPictureData_DEFINED | 8 #ifndef SkPictureData_DEFINED |
9 #define SkPictureData_DEFINED | 9 #define SkPictureData_DEFINED |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #define SK_PICT_BUFFER_SIZE_TAG SkSetFourByteTag('a', 'r', 'a', 'y') | 50 #define SK_PICT_BUFFER_SIZE_TAG SkSetFourByteTag('a', 'r', 'a', 'y') |
51 // these are all inside the ARRAYS tag | 51 // these are all inside the ARRAYS tag |
52 #define SK_PICT_BITMAP_BUFFER_TAG SkSetFourByteTag('b', 't', 'm', 'p') | 52 #define SK_PICT_BITMAP_BUFFER_TAG SkSetFourByteTag('b', 't', 'm', 'p') |
53 #define SK_PICT_PAINT_BUFFER_TAG SkSetFourByteTag('p', 'n', 't', ' ') | 53 #define SK_PICT_PAINT_BUFFER_TAG SkSetFourByteTag('p', 'n', 't', ' ') |
54 #define SK_PICT_PATH_BUFFER_TAG SkSetFourByteTag('p', 't', 'h', ' ') | 54 #define SK_PICT_PATH_BUFFER_TAG SkSetFourByteTag('p', 't', 'h', ' ') |
55 #define SK_PICT_TEXTBLOB_BUFFER_TAG SkSetFourByteTag('b', 'l', 'o', 'b') | 55 #define SK_PICT_TEXTBLOB_BUFFER_TAG SkSetFourByteTag('b', 'l', 'o', 'b') |
56 | 56 |
57 // Always write this guy last (with no length field afterwards) | 57 // Always write this guy last (with no length field afterwards) |
58 #define SK_PICT_EOF_TAG SkSetFourByteTag('e', 'o', 'f', ' ') | 58 #define SK_PICT_EOF_TAG SkSetFourByteTag('e', 'o', 'f', ' ') |
59 | 59 |
60 #ifdef SK_SUPPORT_LEGACY_PICTURE_CLONE | |
61 /** | |
62 * Container for data that is needed to deep copy a SkPicture. The container | |
63 * enables the data to be generated once and reused for subsequent copies. | |
64 */ | |
65 struct SkPictCopyInfo { | |
66 SkPictCopyInfo() : controller(1024) {} | |
67 | |
68 SkChunkFlatController controller; | |
69 SkTDArray<SkFlatData*> paintData; | |
70 }; | |
71 #endif | |
72 | |
73 class SkPictureData { | 60 class SkPictureData { |
74 public: | 61 public: |
75 #ifdef SK_SUPPORT_LEGACY_PICTURE_CLONE | |
76 SkPictureData(const SkPictureData& src, SkPictCopyInfo* deepCopyInfo = NULL)
; | |
77 #endif | |
78 SkPictureData(const SkPictureRecord& record, const SkPictInfo&, bool deepCop
yOps); | 62 SkPictureData(const SkPictureRecord& record, const SkPictInfo&, bool deepCop
yOps); |
79 static SkPictureData* CreateFromStream(SkStream*, | 63 static SkPictureData* CreateFromStream(SkStream*, |
80 const SkPictInfo&, | 64 const SkPictInfo&, |
81 SkPicture::InstallPixelRefProc); | 65 SkPicture::InstallPixelRefProc); |
82 static SkPictureData* CreateFromBuffer(SkReadBuffer&, const SkPictInfo&); | 66 static SkPictureData* CreateFromBuffer(SkReadBuffer&, const SkPictInfo&); |
83 | 67 |
84 virtual ~SkPictureData(); | 68 virtual ~SkPictureData(); |
85 | 69 |
86 const SkPicture::OperationList* getActiveOps(const SkRect& queryRect) const; | 70 const SkPicture::OperationList* getActiveOps(const SkRect& queryRect) const; |
87 | 71 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 * Calls getRecommendedSampleCount with GrPixelConfig and dpi to calculate s
ampleCount | 143 * Calls getRecommendedSampleCount with GrPixelConfig and dpi to calculate s
ampleCount |
160 * and then calls the above version of suitableForGpuRasterization | 144 * and then calls the above version of suitableForGpuRasterization |
161 */ | 145 */ |
162 bool suitableForGpuRasterization(GrContext* context, const char **reason, | 146 bool suitableForGpuRasterization(GrContext* context, const char **reason, |
163 GrPixelConfig config, SkScalar dpi) const; | 147 GrPixelConfig config, SkScalar dpi) const; |
164 | 148 |
165 bool suitableForLayerOptimization() const; | 149 bool suitableForLayerOptimization() const; |
166 #endif | 150 #endif |
167 | 151 |
168 private: | 152 private: |
169 friend class SkPicture; // needed in SkPicture::clone (rm when it is removed
) | |
170 | |
171 void init(); | 153 void init(); |
172 | 154 |
173 // these help us with reading/writing | 155 // these help us with reading/writing |
174 bool parseStreamTag(SkStream*, uint32_t tag, uint32_t size, SkPicture::Insta
llPixelRefProc); | 156 bool parseStreamTag(SkStream*, uint32_t tag, uint32_t size, SkPicture::Insta
llPixelRefProc); |
175 bool parseBufferTag(SkReadBuffer&, uint32_t tag, uint32_t size); | 157 bool parseBufferTag(SkReadBuffer&, uint32_t tag, uint32_t size); |
176 void flattenToBuffer(SkWriteBuffer&) const; | 158 void flattenToBuffer(SkWriteBuffer&) const; |
177 | 159 |
178 // Only used by getBitmap() if the passed in index is SkBitmapHeap::INVALID_
SLOT. This empty | 160 // Only used by getBitmap() if the passed in index is SkBitmapHeap::INVALID_
SLOT. This empty |
179 // bitmap allows playback to draw nothing and move on. | 161 // bitmap allows playback to draw nothing and move on. |
180 SkBitmap fBadBitmap; | 162 SkBitmap fBadBitmap; |
(...skipping 22 matching lines...) Expand all Loading... |
203 | 185 |
204 const SkPictInfo fInfo; | 186 const SkPictInfo fInfo; |
205 | 187 |
206 static void WriteFactories(SkWStream* stream, const SkFactorySet& rec); | 188 static void WriteFactories(SkWStream* stream, const SkFactorySet& rec); |
207 static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec); | 189 static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec); |
208 | 190 |
209 void initForPlayback() const; | 191 void initForPlayback() const; |
210 }; | 192 }; |
211 | 193 |
212 #endif | 194 #endif |
OLD | NEW |