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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 // Note: If the picture version needs to be increased then please follow the | 247 // Note: If the picture version needs to be increased then please follow the |
248 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g
l/qATVcw | 248 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g
l/qATVcw |
249 | 249 |
250 // Only SKPs within the min/current picture version range (inclusive) can be
read. | 250 // Only SKPs within the min/current picture version range (inclusive) can be
read. |
251 static const uint32_t MIN_PICTURE_VERSION = 19; | 251 static const uint32_t MIN_PICTURE_VERSION = 19; |
252 static const uint32_t CURRENT_PICTURE_VERSION = 36; | 252 static const uint32_t CURRENT_PICTURE_VERSION = 36; |
253 | 253 |
254 mutable uint32_t fUniqueID; | 254 mutable uint32_t fUniqueID; |
255 | 255 |
256 // TODO: make SkPictureData const when clone method goes away | 256 SkAutoTDelete<const SkPictureData> fData; |
257 SkAutoTDelete<SkPictureData> fData; | |
258 const SkScalar fCullWidth; | 257 const SkScalar fCullWidth; |
259 const SkScalar fCullHeight; | 258 const SkScalar fCullHeight; |
260 mutable SkAutoTUnref<const AccelData> fAccelData; | 259 mutable SkAutoTUnref<const AccelData> fAccelData; |
261 | 260 |
262 mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are re
fed | 261 mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are re
fed |
263 | 262 |
264 void needsNewGenID() { fUniqueID = SK_InvalidGenID; } | 263 void needsNewGenID() { fUniqueID = SK_InvalidGenID; } |
265 void callDeletionListeners(); | 264 void callDeletionListeners(); |
266 | 265 |
267 // Create a new SkPicture from an existing SkPictureData. The new picture | 266 // Create a new SkPicture from an existing SkPictureData. The new picture |
268 // takes ownership of 'data'. | 267 // takes ownership of 'data'. |
269 SkPicture(SkPictureData* data, SkScalar width, SkScalar height); | 268 SkPicture(SkPictureData* data, SkScalar width, SkScalar height); |
270 | 269 |
271 SkPicture(SkScalar width, SkScalar height, const SkPictureRecord& record, bo
ol deepCopyOps); | 270 SkPicture(SkScalar width, SkScalar height, const SkPictureRecord& record, bo
ol deepCopyOps); |
272 | 271 |
273 // An OperationList encapsulates a set of operation offsets into the picture
byte | |
274 // stream along with the CTMs needed for those operation. | |
275 class OperationList : ::SkNoncopyable { | |
276 public: | |
277 // The following three entry points should only be accessed if | |
278 // 'valid' returns true. | |
279 int numOps() const { return fOps.count(); } | |
280 // The offset in the picture of the operation to execute. | |
281 uint32_t offset(int index) const; | |
282 // The CTM that must be installed for the operation to behave correctly | |
283 const SkMatrix& matrix(int index) const; | |
284 | |
285 SkTDArray<void*> fOps; | |
286 }; | |
287 | |
288 void createHeader(SkPictInfo* info) const; | 272 void createHeader(SkPictInfo* info) const; |
289 static bool IsValidPictInfo(const SkPictInfo& info); | 273 static bool IsValidPictInfo(const SkPictInfo& info); |
290 | 274 |
291 friend class SkPictureData; // to access OperationList | |
292 friend class SkPictureRecorder; // just for SkPicture-based const
ructor | 275 friend class SkPictureRecorder; // just for SkPicture-based const
ructor |
293 friend class SkGpuDevice; // for fData access | 276 friend class SkGpuDevice; // for fData access |
294 friend class GrLayerHoister; // access to fRecord | 277 friend class GrLayerHoister; // access to fRecord |
295 friend class CollectLayers; // access to fRecord | 278 friend class CollectLayers; // access to fRecord |
296 friend class SkPicturePlayback; // to get fData & OperationList | 279 friend class SkPicturePlayback; // to get fData |
297 friend void GrRecordReplaceDraw(const SkPicture* picture, | 280 friend void GrRecordReplaceDraw(const SkPicture* picture, |
298 SkCanvas* canvas, | 281 SkCanvas* canvas, |
299 const GrReplacements* replacements, | 282 const GrReplacements* replacements, |
300 const SkMatrix& initialMatrix, | 283 const SkMatrix& initialMatrix, |
301 SkDrawPictureCallback* callback); | 284 SkDrawPictureCallback* callback); |
302 | 285 |
303 typedef SkRefCnt INHERITED; | 286 typedef SkRefCnt INHERITED; |
304 | 287 |
305 // Takes ownership of the SkRecord, refs the (optional) BBH. | 288 // Takes ownership of the SkRecord, refs the (optional) BBH. |
306 SkPicture(SkScalar width, SkScalar height, SkRecord*, SkBBoxHierarchy*); | 289 SkPicture(SkScalar width, SkScalar height, SkRecord*, SkBBoxHierarchy*); |
(...skipping 14 matching lines...) Expand all Loading... |
321 bool fWillPlaybackBitmaps; | 304 bool fWillPlaybackBitmaps; |
322 bool fHasText; | 305 bool fHasText; |
323 int fNumPaintWithPathEffectUses; | 306 int fNumPaintWithPathEffectUses; |
324 int fNumFastPathDashEffects; | 307 int fNumFastPathDashEffects; |
325 int fNumAAConcavePaths; | 308 int fNumAAConcavePaths; |
326 int fNumAAHairlineConcavePaths; | 309 int fNumAAHairlineConcavePaths; |
327 } fAnalysis; | 310 } fAnalysis; |
328 }; | 311 }; |
329 | 312 |
330 #endif | 313 #endif |
OLD | NEW |