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 |
(...skipping 12 matching lines...) Expand all Loading... |
23 // a single drawBitmap call (using a precomputed bitmap). | 23 // a single drawBitmap call (using a precomputed bitmap). |
24 class GrReplacements { | 24 class GrReplacements { |
25 public: | 25 public: |
26 // All the operations between fStart and fStop (inclusive) will be replaced
with | 26 // All the operations between fStart and fStop (inclusive) will be replaced
with |
27 // a single drawBitmap call using fPos, fBM and fPaint. | 27 // a single drawBitmap call using fPos, fBM and fPaint. |
28 struct ReplacementInfo { | 28 struct ReplacementInfo { |
29 unsigned fStart; | 29 unsigned fStart; |
30 unsigned fStop; | 30 unsigned fStop; |
31 SkIPoint fPos; | 31 SkIPoint fPos; |
32 SkImage* fImage; // Owns a ref | 32 SkImage* fImage; // Owns a ref |
33 const SkPaint* fPaint; // Note: this object doesn't own the paint | 33 const SkPaint* fPaint; // Owned by this object |
34 | 34 |
35 SkIRect fSrcRect; | 35 SkIRect fSrcRect; |
36 }; | 36 }; |
37 | 37 |
38 ~GrReplacements() { this->freeAll(); } | 38 ~GrReplacements() { this->freeAll(); } |
39 | 39 |
40 // Add a new replacement range. The replacement ranges should be | 40 // Add a new replacement range. The replacement ranges should be |
41 // sorted in increasing order and non-overlapping (esp. no nested | 41 // sorted in increasing order and non-overlapping (esp. no nested |
42 // saveLayers). | 42 // saveLayers). |
43 ReplacementInfo* push(); | 43 ReplacementInfo* push(); |
(...skipping 16 matching lines...) Expand all Loading... |
60 | 60 |
61 // Draw an SkRecord into an SkCanvas replacing saveLayer/restore blocks with | 61 // Draw an SkRecord into an SkCanvas replacing saveLayer/restore blocks with |
62 // drawBitmap calls. A convenience wrapper around SkRecords::Draw. | 62 // drawBitmap calls. A convenience wrapper around SkRecords::Draw. |
63 void GrRecordReplaceDraw(const SkRecord&, | 63 void GrRecordReplaceDraw(const SkRecord&, |
64 SkCanvas*, | 64 SkCanvas*, |
65 const SkBBoxHierarchy*, | 65 const SkBBoxHierarchy*, |
66 const GrReplacements*, | 66 const GrReplacements*, |
67 SkDrawPictureCallback*); | 67 SkDrawPictureCallback*); |
68 | 68 |
69 #endif // GrRecordReplaceDraw_DEFINED | 69 #endif // GrRecordReplaceDraw_DEFINED |
OLD | NEW |