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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 path. | 140 path. |
141 */ | 141 */ |
142 kUsePathBoundsForClip_RecordingFlag = 0x01 | 142 kUsePathBoundsForClip_RecordingFlag = 0x01 |
143 }; | 143 }; |
144 | 144 |
145 #ifndef SK_SUPPORT_DEPRECATED_RECORD_FLAGS | 145 #ifndef SK_SUPPORT_DEPRECATED_RECORD_FLAGS |
146 // TODO: once kOptimizeForClippedPlayback_RecordingFlag is hidden from | 146 // TODO: once kOptimizeForClippedPlayback_RecordingFlag is hidden from |
147 // all external consumers, SkPicture::createBBoxHierarchy can also be | 147 // all external consumers, SkPicture::createBBoxHierarchy can also be |
148 // cleaned up. | 148 // cleaned up. |
149 private: | 149 private: |
| 150 friend class SkPictureRecorder; |
150 #endif | 151 #endif |
151 enum Deprecated_RecordingFlags { | 152 enum Deprecated_RecordingFlags { |
152 /* This flag causes the picture to compute bounding boxes and build | 153 /* This flag causes the picture to compute bounding boxes and build |
153 up a spatial hierarchy (currently an R-Tree), plus a tree of Canvas' | 154 up a spatial hierarchy (currently an R-Tree), plus a tree of Canvas' |
154 usually stack-based clip/etc state. This requires an increase in | 155 usually stack-based clip/etc state. This requires an increase in |
155 recording time (often ~2x; likely more for very complex pictures), | 156 recording time (often ~2x; likely more for very complex pictures), |
156 but allows us to perform much faster culling at playback time, and | 157 but allows us to perform much faster culling at playback time, and |
157 completely avoid some unnecessary clips and other operations. This | 158 completely avoid some unnecessary clips and other operations. This |
158 is ideal for tiled rendering, or any other situation where you're | 159 is ideal for tiled rendering, or any other situation where you're |
159 drawing a fraction of a large scene into a smaller viewport. | 160 drawing a fraction of a large scene into a smaller viewport. |
160 | 161 |
161 In most cases the record cost is offset by the playback improvement | 162 In most cases the record cost is offset by the playback improvement |
162 after a frame or two of tiled rendering (and complex pictures that | 163 after a frame or two of tiled rendering (and complex pictures that |
163 induce the worst record times will generally get the largest | 164 induce the worst record times will generally get the largest |
164 speedups at playback time). | 165 speedups at playback time). |
165 | 166 |
166 Note: Currently this is not serializable, the bounding data will be | 167 Note: Currently this is not serializable, the bounding data will be |
167 discarded if you serialize into a stream and then deserialize. | 168 discarded if you serialize into a stream and then deserialize. |
168 */ | 169 */ |
169 kOptimizeForClippedPlayback_RecordingFlag = 0x02, | 170 kOptimizeForClippedPlayback_RecordingFlag = 0x02, |
170 }; | 171 }; |
171 #ifndef SK_SUPPORT_DEPRECATED_RECORD_FLAGS | 172 #ifndef SK_SUPPORT_DEPRECATED_RECORD_FLAGS |
172 public: | 173 public: |
173 #endif | 174 #endif |
174 | 175 |
175 #ifndef SK_SUPPORT_LEGACY_PICTURE_CAN_RECORD | 176 #ifndef SK_SUPPORT_LEGACY_PICTURE_CAN_RECORD |
176 private: | 177 private: |
177 friend class SkPictureRecorder; | 178 friend class SkPictureRecorder; |
178 friend class SkImage_Picture; | |
179 friend class SkSurface_Picture; | |
180 #endif | 179 #endif |
181 | 180 |
182 /** Returns the canvas that records the drawing commands. | 181 /** Returns the canvas that records the drawing commands. |
183 @param width the base width for the picture, as if the recording | 182 @param width the base width for the picture, as if the recording |
184 canvas' bitmap had this width. | 183 canvas' bitmap had this width. |
185 @param height the base width for the picture, as if the recording | 184 @param height the base width for the picture, as if the recording |
186 canvas' bitmap had this height. | 185 canvas' bitmap had this height. |
187 @param recordFlags optional flags that control recording. | 186 @param recordFlags optional flags that control recording. |
188 @return the picture canvas. | 187 @return the picture canvas. |
189 */ | 188 */ |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 } | 487 } |
489 | 488 |
490 private: | 489 private: |
491 SkAutoTUnref<SkPictureFactory> fFactory; | 490 SkAutoTUnref<SkPictureFactory> fFactory; |
492 SkAutoTUnref<SkPicture> fPicture; | 491 SkAutoTUnref<SkPicture> fPicture; |
493 | 492 |
494 typedef SkNoncopyable INHERITED; | 493 typedef SkNoncopyable INHERITED; |
495 }; | 494 }; |
496 | 495 |
497 #endif | 496 #endif |
OLD | NEW |