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 |
11 #define SkPicture_DEFINED | 11 #define SkPicture_DEFINED |
12 | 12 |
13 #include "SkBitmap.h" | 13 #include "SkBitmap.h" |
14 #include "SkDrawPictureCallback.h" | 14 #include "SkDrawPictureCallback.h" |
15 #include "SkImageDecoder.h" | 15 #include "SkImageDecoder.h" |
16 #include "SkRefCnt.h" | 16 #include "SkRefCnt.h" |
17 #include "SkTDArray.h" | 17 #include "SkTDArray.h" |
18 | 18 |
19 #if SK_SUPPORT_GPU | 19 #if SK_SUPPORT_GPU |
20 class GrContext; | 20 class GrContext; |
21 #endif | 21 #endif |
22 | 22 |
23 class SkBBoxHierarchy; | 23 class SkBBoxHierarchy; |
24 class SkCanvas; | 24 class SkCanvas; |
25 class SkData; | 25 class SkData; |
26 class SkPictureData; | 26 class SkPictureData; |
27 class SkPictureRecord; | |
28 class SkStream; | 27 class SkStream; |
29 class SkWStream; | 28 class SkWStream; |
30 | 29 |
31 struct SkPictInfo; | 30 struct SkPictInfo; |
32 | 31 |
33 class SkRecord; | 32 class SkRecord; |
34 | 33 |
35 namespace SkRecords { | 34 namespace SkRecords { |
36 class CollectLayers; | 35 class CollectLayers; |
37 }; | 36 }; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // V36: Remove (obsolete) alphatype from SkColorTable | 246 // V36: Remove (obsolete) alphatype from SkColorTable |
248 // V37: Added shadow only option to SkDropShadowImageFilter | 247 // V37: Added shadow only option to SkDropShadowImageFilter |
249 | 248 |
250 // Note: If the picture version needs to be increased then please follow the | 249 // Note: If the picture version needs to be increased then please follow the |
251 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g
l/qATVcw | 250 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g
l/qATVcw |
252 | 251 |
253 // Only SKPs within the min/current picture version range (inclusive) can be
read. | 252 // Only SKPs within the min/current picture version range (inclusive) can be
read. |
254 static const uint32_t MIN_PICTURE_VERSION = 19; | 253 static const uint32_t MIN_PICTURE_VERSION = 19; |
255 static const uint32_t CURRENT_PICTURE_VERSION = 37; | 254 static const uint32_t CURRENT_PICTURE_VERSION = 37; |
256 | 255 |
257 mutable uint32_t fUniqueID; | |
258 | |
259 SkAutoTDelete<const SkPictureData> fData; | |
260 const SkScalar fCullWidth; | |
261 const SkScalar fCullHeight; | |
262 mutable SkAutoTUnref<const AccelData> fAccelData; | |
263 | |
264 mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are re
fed | |
265 | |
266 void needsNewGenID() { fUniqueID = SK_InvalidGenID; } | 256 void needsNewGenID() { fUniqueID = SK_InvalidGenID; } |
267 void callDeletionListeners(); | 257 void callDeletionListeners(); |
268 | 258 |
269 // Create a new SkPicture from an existing SkPictureData. The new picture | |
270 // takes ownership of 'data'. | |
271 SkPicture(SkPictureData* data, SkScalar width, SkScalar height); | |
272 | |
273 SkPicture(SkScalar width, SkScalar height, const SkPictureRecord& record, bo
ol deepCopyOps); | |
274 | |
275 void createHeader(SkPictInfo* info) const; | 259 void createHeader(SkPictInfo* info) const; |
276 static bool IsValidPictInfo(const SkPictInfo& info); | 260 static bool IsValidPictInfo(const SkPictInfo& info); |
277 | 261 |
278 friend class SkPictureRecorder; // SkRecord-based constructor. | |
279 friend class SkGpuDevice; // for fData access | |
280 friend class GrLayerHoister; // access to fRecord | |
281 friend class SkPicturePlayback; // to get fData | |
282 friend class ReplaceDraw; | |
283 | |
284 typedef SkRefCnt INHERITED; | |
285 | |
286 // Takes ownership of the SkRecord, refs the (optional) BBH. | 262 // Takes ownership of the SkRecord, refs the (optional) BBH. |
287 SkPicture(SkScalar width, SkScalar height, SkRecord*, SkBBoxHierarchy*); | 263 SkPicture(SkScalar width, SkScalar height, SkRecord*, SkBBoxHierarchy*); |
288 // Return as a new SkPicture that's backed by SkRecord. | |
289 static SkPicture* Forwardport(const SkPicture&); | |
290 // Return as a new SkPicture that's backed by the old backend. | |
291 static SkPicture* Backport(const SkRecord& src, const SkRect& cullRect); | |
292 | 264 |
| 265 static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*); |
| 266 static SkPictureData* Backport(const SkRecord&, const SkPictInfo&); |
| 267 |
| 268 const SkScalar fCullWidth; |
| 269 const SkScalar fCullHeight; |
| 270 mutable SkAutoTUnref<const AccelData> fAccelData; |
| 271 mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are re
fed |
293 SkAutoTDelete<SkRecord> fRecord; | 272 SkAutoTDelete<SkRecord> fRecord; |
294 SkAutoTUnref<SkBBoxHierarchy> fBBH; | 273 SkAutoTUnref<SkBBoxHierarchy> fBBH; |
295 | |
296 struct PathCounter; | |
297 | |
298 struct Analysis { | 274 struct Analysis { |
299 Analysis() {} // Only used by SkPictureData codepath. | 275 Analysis() {} // Only used by SkPictureData codepath. |
300 explicit Analysis(const SkRecord&); | 276 explicit Analysis(const SkRecord&); |
301 | 277 |
302 bool suitableForGpuRasterization(const char** reason, int sampleCount) c
onst; | 278 bool suitableForGpuRasterization(const char** reason, int sampleCount) c
onst; |
303 | 279 |
304 bool fWillPlaybackBitmaps; | 280 bool fWillPlaybackBitmaps; |
305 bool fHasText; | 281 bool fHasText; |
306 int fNumPaintWithPathEffectUses; | 282 int fNumPaintWithPathEffectUses; |
307 int fNumFastPathDashEffects; | 283 int fNumFastPathDashEffects; |
308 int fNumAAConcavePaths; | 284 int fNumAAConcavePaths; |
309 int fNumAAHairlineConcavePaths; | 285 int fNumAAHairlineConcavePaths; |
310 int fNumAADFEligibleConcavePaths; | 286 int fNumAADFEligibleConcavePaths; |
311 } fAnalysis; | 287 } fAnalysis; |
| 288 mutable uint32_t fUniqueID; |
| 289 |
| 290 struct PathCounter; |
| 291 |
| 292 friend class SkPictureRecorder; // SkRecord-based constructor. |
| 293 friend class GrLayerHoister; // access to fRecord |
| 294 friend class ReplaceDraw; |
| 295 |
| 296 typedef SkRefCnt INHERITED; |
312 }; | 297 }; |
313 | 298 |
314 #endif | 299 #endif |
OLD | NEW |