| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 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 #ifndef SkPicturePlayback_DEFINED | 9 #ifndef SkPicturePlayback_DEFINED |
| 10 #define SkPicturePlayback_DEFINED | 10 #define SkPicturePlayback_DEFINED |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // PlaybackReplacements collects op ranges that can be replaced with | 266 // PlaybackReplacements collects op ranges that can be replaced with |
| 267 // a single drawBitmap call (using a precomputed bitmap). | 267 // a single drawBitmap call (using a precomputed bitmap). |
| 268 class PlaybackReplacements { | 268 class PlaybackReplacements { |
| 269 public: | 269 public: |
| 270 // All the operations between fStart and fStop (inclusive) will be repla
ced with | 270 // All the operations between fStart and fStop (inclusive) will be repla
ced with |
| 271 // a single drawBitmap call using fPos, fBM and fPaint. | 271 // a single drawBitmap call using fPos, fBM and fPaint. |
| 272 // fPaint will be NULL if the picture's paint wasn't copyable | 272 // fPaint will be NULL if the picture's paint wasn't copyable |
| 273 struct ReplacementInfo { | 273 struct ReplacementInfo { |
| 274 size_t fStart; | 274 size_t fStart; |
| 275 size_t fStop; | 275 size_t fStop; |
| 276 SkPoint fPos; | 276 SkIPoint fPos; |
| 277 SkBitmap* fBM; | 277 SkBitmap* fBM; |
| 278 const SkPaint* fPaint; // Note: this object doesn't own the paint | 278 const SkPaint* fPaint; // Note: this object doesn't own the paint |
| 279 }; | 279 }; |
| 280 | 280 |
| 281 ~PlaybackReplacements() { this->freeAll(); } | 281 ~PlaybackReplacements() { this->freeAll(); } |
| 282 | 282 |
| 283 // Add a new replacement range. The replacement ranges should be | 283 // Add a new replacement range. The replacement ranges should be |
| 284 // sorted in increasing order and non-overlapping (esp. no nested | 284 // sorted in increasing order and non-overlapping (esp. no nested |
| 285 // saveLayers). | 285 // saveLayers). |
| 286 ReplacementInfo* push(); | 286 ReplacementInfo* push(); |
| 287 | 287 |
| 288 private: | 288 private: |
| 289 friend class SkPicturePlayback; // for access to lookupByStart | 289 friend class SkPicturePlayback; // for access to lookupByStart |
| 290 | 290 |
| 291 // look up a replacement range by its start offset | 291 // look up a replacement range by its start offset |
| 292 ReplacementInfo* lookupByStart(size_t start); | 292 ReplacementInfo* lookupByStart(size_t start); |
| 293 | 293 |
| 294 void freeAll(); | 294 void freeAll(); |
| 295 | 295 |
| 296 #ifdef SK_DEBUG | 296 #ifdef SK_DEBUG |
| 297 void validate() const; | 297 void validate() const; |
| 298 #endif | 298 #endif |
| 299 | 299 |
| 300 SkTDArray<ReplacementInfo> fReplacements; | 300 SkTDArray<ReplacementInfo> fReplacements; |
| 301 }; | 301 }; |
| 302 | 302 |
| 303 | |
| 304 // Replace all the draw ops in the replacement ranges in 'replacements' with | 303 // Replace all the draw ops in the replacement ranges in 'replacements' with |
| 305 // the associated drawBitmap call | 304 // the associated drawBitmap call |
| 306 // Draw replacing cannot be enabled at the same time as draw limiting | 305 // Draw replacing cannot be enabled at the same time as draw limiting |
| 307 void setReplacements(PlaybackReplacements* replacements) { | 306 void setReplacements(PlaybackReplacements* replacements) { |
| 308 SkASSERT(fStart == 0 && fStop == 0); | 307 SkASSERT(fStart == 0 && fStop == 0); |
| 309 fReplacements = replacements; | 308 fReplacements = replacements; |
| 310 } | 309 } |
| 311 | 310 |
| 312 bool fUseBBH; | 311 bool fUseBBH; |
| 313 size_t fStart; | 312 size_t fStart; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 static void WriteFactories(SkWStream* stream, const SkFactorySet& rec); | 347 static void WriteFactories(SkWStream* stream, const SkFactorySet& rec); |
| 349 static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec); | 348 static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec); |
| 350 | 349 |
| 351 #ifdef SK_BUILD_FOR_ANDROID | 350 #ifdef SK_BUILD_FOR_ANDROID |
| 352 SkMutex fDrawMutex; | 351 SkMutex fDrawMutex; |
| 353 bool fAbortCurrentPlayback; | 352 bool fAbortCurrentPlayback; |
| 354 #endif | 353 #endif |
| 355 }; | 354 }; |
| 356 | 355 |
| 357 #endif | 356 #endif |
| OLD | NEW |