| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrRecordReplaceDraw_DEFINED | 8 #ifndef GrRecordReplaceDraw_DEFINED |
| 9 #define GrRecordReplaceDraw_DEFINED | 9 #define GrRecordReplaceDraw_DEFINED |
| 10 | 10 |
| 11 #include "SkDrawPictureCallback.h" | 11 #include "SkDrawPictureCallback.h" |
| 12 #include "SkRect.h" | 12 #include "SkRect.h" |
| 13 #include "SkTDArray.h" | 13 #include "SkTDArray.h" |
| 14 | 14 |
| 15 class SkBBoxHierarchy; | 15 class SkBBoxHierarchy; |
| 16 class SkBitmap; | 16 class SkBitmap; |
| 17 class SkCanvas; | 17 class SkCanvas; |
| 18 class SkImage; | 18 class SkImage; |
| 19 class SkMatrix; |
| 19 class SkPaint; | 20 class SkPaint; |
| 21 class SkPicture; |
| 20 class SkRecord; | 22 class SkRecord; |
| 21 | 23 |
| 22 // GrReplacements collects op ranges that can be replaced with | 24 // GrReplacements collects op ranges that can be replaced with |
| 23 // a single drawBitmap call (using a precomputed bitmap). | 25 // a single drawBitmap call (using a precomputed bitmap). |
| 24 class GrReplacements { | 26 class GrReplacements { |
| 25 public: | 27 public: |
| 26 // All the operations between fStart and fStop (inclusive) will be replaced
with | 28 // All the operations between fStart and fStop (inclusive) will be replaced
with |
| 27 // a single drawBitmap call using fPos, fBM and fPaint. | 29 // a single drawBitmap call using fPos, fBM and fPaint. |
| 28 struct ReplacementInfo { | 30 struct ReplacementInfo { |
| 29 unsigned fStart; | 31 unsigned fStart; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 51 private: | 53 private: |
| 52 SkTDArray<ReplacementInfo> fReplacements; | 54 SkTDArray<ReplacementInfo> fReplacements; |
| 53 | 55 |
| 54 void freeAll(); | 56 void freeAll(); |
| 55 | 57 |
| 56 #ifdef SK_DEBUG | 58 #ifdef SK_DEBUG |
| 57 void validate() const; | 59 void validate() const; |
| 58 #endif | 60 #endif |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 // Draw an SkRecord into an SkCanvas replacing saveLayer/restore blocks with | 63 // Draw an SkPicture into an SkCanvas replacing saveLayer/restore blocks with |
| 62 // drawBitmap calls. A convenience wrapper around SkRecords::Draw. | 64 // drawBitmap calls. A convenience wrapper around SkRecords::Draw. |
| 63 void GrRecordReplaceDraw(const SkRecord&, | 65 void GrRecordReplaceDraw(const SkPicture*, |
| 64 SkCanvas*, | 66 SkCanvas*, |
| 65 const SkBBoxHierarchy*, | |
| 66 const GrReplacements*, | 67 const GrReplacements*, |
| 68 const SkMatrix&, |
| 67 SkDrawPictureCallback*); | 69 SkDrawPictureCallback*); |
| 68 | 70 |
| 69 #endif // GrRecordReplaceDraw_DEFINED | 71 #endif // GrRecordReplaceDraw_DEFINED |
| OLD | NEW |