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 SkRecorder_DEFINED | 8 #ifndef SkRecorder_DEFINED |
9 #define SkRecorder_DEFINED | 9 #define SkRecorder_DEFINED |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 }; | 34 }; |
35 | 35 |
36 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. | 36 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. |
37 | 37 |
38 class SkRecorder : public SkCanvas { | 38 class SkRecorder : public SkCanvas { |
39 public: | 39 public: |
40 // Does not take ownership of the SkRecord. | 40 // Does not take ownership of the SkRecord. |
41 SkRecorder(SkRecord*, int width, int height, SkMiniRecorder* = nullptr); /
/ legacy version | 41 SkRecorder(SkRecord*, int width, int height, SkMiniRecorder* = nullptr); /
/ legacy version |
42 SkRecorder(SkRecord*, const SkRect& bounds, SkMiniRecorder* = nullptr); | 42 SkRecorder(SkRecord*, const SkRect& bounds, SkMiniRecorder* = nullptr); |
43 | 43 |
44 void reset(SkRecord*, const SkRect& bounds, SkMiniRecorder* = nullptr); | 44 enum DrawPictureMode { Record_DrawPictureMode, Playback_DrawPictureMode }; |
| 45 void reset(SkRecord*, const SkRect& bounds, DrawPictureMode, SkMiniRecorder*
= nullptr); |
45 | 46 |
46 size_t approxBytesUsedBySubPictures() const { return fApproxBytesUsedBySubPi
ctures; } | 47 size_t approxBytesUsedBySubPictures() const { return fApproxBytesUsedBySubPi
ctures; } |
47 | 48 |
48 SkDrawableList* getDrawableList() const { return fDrawableList.get(); } | 49 SkDrawableList* getDrawableList() const { return fDrawableList.get(); } |
49 SkDrawableList* detachDrawableList() { return fDrawableList.detach(); } | 50 SkDrawableList* detachDrawableList() { return fDrawableList.detach(); } |
50 | 51 |
51 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor
der will fail. | 52 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor
der will fail. |
52 void forgetRecord(); | 53 void forgetRecord(); |
53 | 54 |
54 void willSave() override; | 55 void willSave() override; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 131 |
131 template <typename T> | 132 template <typename T> |
132 T* copy(const T[], size_t count); | 133 T* copy(const T[], size_t count); |
133 | 134 |
134 SkIRect devBounds() const { | 135 SkIRect devBounds() const { |
135 SkIRect devBounds; | 136 SkIRect devBounds; |
136 this->getClipDeviceBounds(&devBounds); | 137 this->getClipDeviceBounds(&devBounds); |
137 return devBounds; | 138 return devBounds; |
138 } | 139 } |
139 | 140 |
| 141 DrawPictureMode fDrawPictureMode; |
140 size_t fApproxBytesUsedBySubPictures; | 142 size_t fApproxBytesUsedBySubPictures; |
141 SkRecord* fRecord; | 143 SkRecord* fRecord; |
142 SkAutoTDelete<SkDrawableList> fDrawableList; | 144 SkAutoTDelete<SkDrawableList> fDrawableList; |
143 | 145 |
144 SkMiniRecorder* fMiniRecorder; | 146 SkMiniRecorder* fMiniRecorder; |
145 }; | 147 }; |
146 | 148 |
147 #endif//SkRecorder_DEFINED | 149 #endif//SkRecorder_DEFINED |
OLD | NEW |