| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 static bool InternalOnly_StreamIsSKP(SkStream*, SkPictInfo*); | 193 static bool InternalOnly_StreamIsSKP(SkStream*, SkPictInfo*); |
| 194 static bool InternalOnly_BufferIsSKP(SkReadBuffer&, SkPictInfo*); | 194 static bool InternalOnly_BufferIsSKP(SkReadBuffer&, SkPictInfo*); |
| 195 | 195 |
| 196 /** Return true if the picture is suitable for rendering on the GPU. | 196 /** Return true if the picture is suitable for rendering on the GPU. |
| 197 */ | 197 */ |
| 198 | 198 |
| 199 #if SK_SUPPORT_GPU | 199 #if SK_SUPPORT_GPU |
| 200 bool suitableForGpuRasterization(GrContext*, const char ** = NULL) const; | 200 bool suitableForGpuRasterization(GrContext*, const char ** = NULL) const; |
| 201 #endif | 201 #endif |
| 202 | 202 |
| 203 protected: | 203 private: |
| 204 // V2 : adds SkPixelRef's generation ID. | 204 // V2 : adds SkPixelRef's generation ID. |
| 205 // V3 : PictInfo tag at beginning, and EOF tag at the end | 205 // V3 : PictInfo tag at beginning, and EOF tag at the end |
| 206 // V4 : move SkPictInfo to be the header | 206 // V4 : move SkPictInfo to be the header |
| 207 // V5 : don't read/write FunctionPtr on cross-process (we can detect that) | 207 // V5 : don't read/write FunctionPtr on cross-process (we can detect that) |
| 208 // V6 : added serialization of SkPath's bounds (and packed its flags tighter
) | 208 // V6 : added serialization of SkPath's bounds (and packed its flags tighter
) |
| 209 // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect) | 209 // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect) |
| 210 // V8 : Add an option for encoding bitmaps | 210 // V8 : Add an option for encoding bitmaps |
| 211 // V9 : Allow the reader and writer of an SKP disagree on whether to support | 211 // V9 : Allow the reader and writer of an SKP disagree on whether to support |
| 212 // SK_SUPPORT_HINTING_SCALE_FACTOR | 212 // SK_SUPPORT_HINTING_SCALE_FACTOR |
| 213 // V10: add drawRRect, drawOval, clipRRect | 213 // V10: add drawRRect, drawOval, clipRRect |
| (...skipping 20 matching lines...) Expand all Loading... |
| 234 | 234 |
| 235 // Note: If the picture version needs to be increased then please follow the | 235 // Note: If the picture version needs to be increased then please follow the |
| 236 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g
l/qATVcw | 236 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g
l/qATVcw |
| 237 | 237 |
| 238 // Only SKPs within the min/current picture version range (inclusive) can be
read. | 238 // Only SKPs within the min/current picture version range (inclusive) can be
read. |
| 239 static const uint32_t MIN_PICTURE_VERSION = 19; | 239 static const uint32_t MIN_PICTURE_VERSION = 19; |
| 240 static const uint32_t CURRENT_PICTURE_VERSION = 29; | 240 static const uint32_t CURRENT_PICTURE_VERSION = 29; |
| 241 | 241 |
| 242 mutable uint32_t fUniqueID; | 242 mutable uint32_t fUniqueID; |
| 243 | 243 |
| 244 // TODO: make fData and fWidth/fHeight private | 244 SkAutoTDelete<const SkPictureData> fData; |
| 245 SkAutoTDelete<SkPictureData> fData; | |
| 246 int fWidth, fHeight; | 245 int fWidth, fHeight; |
| 247 mutable SkAutoTUnref<const AccelData> fAccelData; | 246 mutable SkAutoTUnref<const AccelData> fAccelData; |
| 248 | 247 |
| 249 void needsNewGenID() { fUniqueID = SK_InvalidGenID; } | 248 void needsNewGenID() { fUniqueID = SK_InvalidGenID; } |
| 250 | 249 |
| 251 // Create a new SkPicture from an existing SkPictureData. Ref count of | 250 // Create a new SkPicture from an existing SkPictureData. Ref count of |
| 252 // data is unchanged. | 251 // data is unchanged. |
| 253 SkPicture(SkPictureData* data, int width, int height); | 252 SkPicture(SkPictureData* data, int width, int height); |
| 254 | 253 |
| 255 SkPicture(int width, int height, const SkPictureRecord& record, bool deepCop
yOps); | 254 SkPicture(int width, int height, const SkPictureRecord& record, bool deepCop
yOps); |
| 256 | 255 |
| 257 private: | |
| 258 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); | 256 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); |
| 259 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); | 257 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); |
| 260 | 258 |
| 261 // An OperationList encapsulates a set of operation offsets into the picture
byte | 259 // An OperationList encapsulates a set of operation offsets into the picture
byte |
| 262 // stream along with the CTMs needed for those operation. | 260 // stream along with the CTMs needed for those operation. |
| 263 class OperationList : ::SkNoncopyable { | 261 class OperationList : ::SkNoncopyable { |
| 264 public: | 262 public: |
| 265 // The following three entry points should only be accessed if | 263 // The following three entry points should only be accessed if |
| 266 // 'valid' returns true. | 264 // 'valid' returns true. |
| 267 int numOps() const { return fOps.count(); } | 265 int numOps() const { return fOps.count(); } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 291 friend class SkPicturePlayback; // to get fData | 289 friend class SkPicturePlayback; // to get fData |
| 292 | 290 |
| 293 typedef SkRefCnt INHERITED; | 291 typedef SkRefCnt INHERITED; |
| 294 | 292 |
| 295 SkPicture(int width, int height, SkRecord*); // Takes ownership. | 293 SkPicture(int width, int height, SkRecord*); // Takes ownership. |
| 296 SkAutoTDelete<SkRecord> fRecord; | 294 SkAutoTDelete<SkRecord> fRecord; |
| 297 bool fRecordWillPlayBackBitmaps; // TODO: const | 295 bool fRecordWillPlayBackBitmaps; // TODO: const |
| 298 }; | 296 }; |
| 299 | 297 |
| 300 #endif | 298 #endif |
| OLD | NEW |