OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2007 The Android Open Source Project | 3 * Copyright 2007 The Android Open Source Project |
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 SkPicture_DEFINED | 10 #ifndef SkPicture_DEFINED |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 int width() const { return fCullRect.roundOut().width(); } | 121 int width() const { return fCullRect.roundOut().width(); } |
122 int height() const { return fCullRect.roundOut().height(); } | 122 int height() const { return fCullRect.roundOut().height(); } |
123 #endif | 123 #endif |
124 | 124 |
125 /** Return the cull rect used when creating this picture: { 0, 0, cullWidth,
cullHeight }. | 125 /** Return the cull rect used when creating this picture: { 0, 0, cullWidth,
cullHeight }. |
126 It does not necessarily reflect the bounds of what has been recorded int
o the picture. | 126 It does not necessarily reflect the bounds of what has been recorded int
o the picture. |
127 @return the cull rect used to create this picture | 127 @return the cull rect used to create this picture |
128 */ | 128 */ |
129 SkRect cullRect() const { return fCullRect; } | 129 SkRect cullRect() const { return fCullRect; } |
130 | 130 |
131 /** Return a non-zero, unique value representing the picture. This call is | 131 /** Return a non-zero, unique value representing the picture. |
132 only valid when not recording. Between a beginRecording/endRecording | 132 */ |
133 pair it will just return 0 (the invalid ID). Each beginRecording/ | 133 uint32_t uniqueID() const { return fUniqueID; } |
134 endRecording pair will cause a different generation ID to be returned. | |
135 */ | |
136 uint32_t uniqueID() const; | |
137 | 134 |
138 /** | 135 /** |
139 * Function to encode an SkBitmap to an SkData. A function with this | 136 * Function to encode an SkBitmap to an SkData. A function with this |
140 * signature can be passed to serialize() and SkWriteBuffer. | 137 * signature can be passed to serialize() and SkWriteBuffer. |
141 * Returning NULL will tell the SkWriteBuffer to use | 138 * Returning NULL will tell the SkWriteBuffer to use |
142 * SkBitmap::flatten() to store the bitmap. | 139 * SkBitmap::flatten() to store the bitmap. |
143 * | 140 * |
144 * @param pixelRefOffset DEPRECATED -- caller assumes it will return 0. | 141 * @param pixelRefOffset DEPRECATED -- caller assumes it will return 0. |
145 * @return SkData If non-NULL, holds encoded data representing the passed | 142 * @return SkData If non-NULL, holds encoded data representing the passed |
146 * in bitmap. The caller is responsible for calling unref(). | 143 * in bitmap. The caller is responsible for calling unref(). |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // V36: Remove (obsolete) alphatype from SkColorTable | 239 // V36: Remove (obsolete) alphatype from SkColorTable |
243 // V37: Added shadow only option to SkDropShadowImageFilter | 240 // V37: Added shadow only option to SkDropShadowImageFilter |
244 | 241 |
245 // Note: If the picture version needs to be increased then please follow the | 242 // Note: If the picture version needs to be increased then please follow the |
246 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g
l/qATVcw | 243 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g
l/qATVcw |
247 | 244 |
248 // Only SKPs within the min/current picture version range (inclusive) can be
read. | 245 // Only SKPs within the min/current picture version range (inclusive) can be
read. |
249 static const uint32_t MIN_PICTURE_VERSION = 19; | 246 static const uint32_t MIN_PICTURE_VERSION = 19; |
250 static const uint32_t CURRENT_PICTURE_VERSION = 37; | 247 static const uint32_t CURRENT_PICTURE_VERSION = 37; |
251 | 248 |
252 void needsNewGenID() { fUniqueID = SK_InvalidGenID; } | |
253 void callDeletionListeners(); | 249 void callDeletionListeners(); |
254 | 250 |
255 void createHeader(SkPictInfo* info) const; | 251 void createHeader(SkPictInfo* info) const; |
256 static bool IsValidPictInfo(const SkPictInfo& info); | 252 static bool IsValidPictInfo(const SkPictInfo& info); |
257 | 253 |
258 // Takes ownership of the SkRecord, refs the (optional) drawablePicts and BB
H. | 254 // Takes ownership of the SkRecord, refs the (optional) drawablePicts and BB
H. |
259 SkPicture(const SkRect& cullRect, SkRecord*, SkData* drawablePicts, | 255 SkPicture(const SkRect& cullRect, SkRecord*, SkData* drawablePicts, |
260 SkBBoxHierarchy*); | 256 SkBBoxHierarchy*); |
261 | 257 |
262 static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*); | 258 static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*); |
263 static SkPictureData* Backport(const SkRecord&, const SkPictInfo&, | 259 static SkPictureData* Backport(const SkRecord&, const SkPictInfo&, |
264 SkPicture const* const drawablePics[], int dr
awableCount); | 260 SkPicture const* const drawablePics[], int dr
awableCount); |
265 | 261 |
266 // uint32_t fRefCnt; from SkNVRefCnt<SkPicture> | 262 // uint32_t fRefCnt; from SkNVRefCnt<SkPicture> |
267 mutable uint32_t fUniqueID; | 263 const uint32_t fUniqueID; |
268 const SkRect fCullRect; | 264 const SkRect fCullRect; |
269 mutable SkAutoTUnref<const AccelData> fAccelData; | 265 mutable SkAutoTUnref<const AccelData> fAccelData; |
270 mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are re
fed | 266 mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are re
fed |
271 SkAutoTDelete<SkRecord> fRecord; | 267 SkAutoTDelete<const SkRecord> fRecord; |
272 SkAutoTUnref<SkBBoxHierarchy> fBBH; | 268 SkAutoTUnref<const SkBBoxHierarchy> fBBH; |
273 SkAutoTUnref<SkData> fDrawablePicts; | 269 SkAutoTUnref<SkData> fDrawablePicts; |
274 | 270 |
275 // helpers for fDrawablePicts | 271 // helpers for fDrawablePicts |
276 int drawableCount() const; | 272 int drawableCount() const; |
277 // will return NULL if drawableCount() returns 0 | 273 // will return NULL if drawableCount() returns 0 |
278 SkPicture const* const* drawablePicts() const; | 274 SkPicture const* const* drawablePicts() const; |
279 | 275 |
280 struct PathCounter; | 276 struct PathCounter; |
281 | 277 |
282 struct Analysis { | 278 struct Analysis { |
(...skipping 12 matching lines...) Expand all Loading... |
295 } fAnalysis; | 291 } fAnalysis; |
296 | 292 |
297 friend class SkPictureRecorder; // SkRecord-based constructor. | 293 friend class SkPictureRecorder; // SkRecord-based constructor. |
298 friend class GrLayerHoister; // access to fRecord | 294 friend class GrLayerHoister; // access to fRecord |
299 friend class ReplaceDraw; | 295 friend class ReplaceDraw; |
300 friend class SkPictureUtils; | 296 friend class SkPictureUtils; |
301 }; | 297 }; |
302 SK_COMPILE_ASSERT(sizeof(SkPicture) <= 96, SkPictureSize); | 298 SK_COMPILE_ASSERT(sizeof(SkPicture) <= 96, SkPictureSize); |
303 | 299 |
304 #endif | 300 #endif |
OLD | NEW |