| 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 | 18 |
| 18 #if SK_SUPPORT_GPU | 19 #if SK_SUPPORT_GPU |
| 19 class GrContext; | 20 class GrContext; |
| 20 #endif | 21 #endif |
| 21 | 22 |
| 22 class SkBBHFactory; | 23 class SkBBHFactory; |
| 23 class SkBBoxHierarchy; | 24 class SkBBoxHierarchy; |
| 24 class SkCanvas; | 25 class SkCanvas; |
| 25 class SkData; | 26 class SkData; |
| 26 class SkPictureData; | 27 class SkPictureData; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 SkPicture(int width, int height, const SkPictureRecord& record, bool deepCop
yOps); | 255 SkPicture(int width, int height, const SkPictureRecord& record, bool deepCop
yOps); |
| 255 | 256 |
| 256 private: | 257 private: |
| 257 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); | 258 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); |
| 258 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); | 259 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); |
| 259 | 260 |
| 260 // An OperationList encapsulates a set of operation offsets into the picture
byte | 261 // An OperationList encapsulates a set of operation offsets into the picture
byte |
| 261 // stream along with the CTMs needed for those operation. | 262 // stream along with the CTMs needed for those operation. |
| 262 class OperationList : ::SkNoncopyable { | 263 class OperationList : ::SkNoncopyable { |
| 263 public: | 264 public: |
| 264 virtual ~OperationList() {} | |
| 265 | |
| 266 // The following three entry points should only be accessed if | 265 // The following three entry points should only be accessed if |
| 267 // 'valid' returns true. | 266 // 'valid' returns true. |
| 268 virtual int numOps() const { SkASSERT(false); return 0; }; | 267 int numOps() const { return fOps.count(); } |
| 269 // The offset in the picture of the operation to execute. | 268 // The offset in the picture of the operation to execute. |
| 270 virtual uint32_t offset(int index) const { SkASSERT(false); return 0; }; | 269 uint32_t offset(int index) const; |
| 271 // The CTM that must be installed for the operation to behave correctly | 270 // The CTM that must be installed for the operation to behave correctly |
| 272 virtual const SkMatrix& matrix(int index) const { SkASSERT(false); retur
n SkMatrix::I(); } | 271 const SkMatrix& matrix(int index) const; |
| 272 |
| 273 SkTDArray<void*> fOps; |
| 273 }; | 274 }; |
| 274 | 275 |
| 275 /** PRIVATE / EXPERIMENTAL -- do not call | 276 /** PRIVATE / EXPERIMENTAL -- do not call |
| 276 Return the operations required to render the content inside 'queryRect'. | 277 Return the operations required to render the content inside 'queryRect'. |
| 277 */ | 278 */ |
| 278 const OperationList* EXPERIMENTAL_getActiveOps(const SkIRect& queryRect) con
st; | 279 const OperationList* EXPERIMENTAL_getActiveOps(const SkIRect& queryRect) con
st; |
| 279 | 280 |
| 280 void createHeader(SkPictInfo* info) const; | 281 void createHeader(SkPictInfo* info) const; |
| 281 static bool IsValidPictInfo(const SkPictInfo& info); | 282 static bool IsValidPictInfo(const SkPictInfo& info); |
| 282 | 283 |
| 283 friend class SkFlatPicture; | 284 friend class SkFlatPicture; |
| 284 friend class SkPictureData; | 285 friend class SkPictureData; |
| 285 friend class SkPictureRecorder; // just for SkPicture-based constructor | 286 friend class SkPictureRecorder; // just for SkPicture-based constructor |
| 286 friend class SkGpuDevice; | 287 friend class SkGpuDevice; |
| 287 friend class GrGatherCanvas; | 288 friend class GrGatherCanvas; |
| 288 friend class GrGatherDevice; | 289 friend class GrGatherDevice; |
| 289 friend class SkDebugCanvas; | 290 friend class SkDebugCanvas; |
| 290 friend class SkPicturePlayback; // to get fData | 291 friend class SkPicturePlayback; // to get fData |
| 291 | 292 |
| 292 typedef SkRefCnt INHERITED; | 293 typedef SkRefCnt INHERITED; |
| 293 | 294 |
| 294 SkPicture(int width, int height, SkRecord*); // Takes ownership. | 295 SkPicture(int width, int height, SkRecord*); // Takes ownership. |
| 295 SkAutoTDelete<SkRecord> fRecord; | 296 SkAutoTDelete<SkRecord> fRecord; |
| 296 bool fRecordWillPlayBackBitmaps; // TODO: const | 297 bool fRecordWillPlayBackBitmaps; // TODO: const |
| 297 }; | 298 }; |
| 298 | 299 |
| 299 #endif | 300 #endif |
| OLD | NEW |