| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 SkPicture* clone() const; | 82 SkPicture* clone() const; |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * Creates multiple thread-safe clones of this picture that are ready for | 85 * Creates multiple thread-safe clones of this picture that are ready for |
| 86 * playback. The resulting clones are stored in the provided array of | 86 * playback. The resulting clones are stored in the provided array of |
| 87 * SkPictures. | 87 * SkPictures. |
| 88 */ | 88 */ |
| 89 void clone(SkPicture* pictures, int count) const; | 89 void clone(SkPicture* pictures, int count) const; |
| 90 | 90 |
| 91 enum RecordingFlags { | 91 enum RecordingFlags { |
| 92 /* This flag specifies that when clipPath() is called, the path will | 92 /** This flag specifies that when clipPath() is called, the path will |
| 93 be faithfully recorded, but the recording canvas' current clip will | 93 be faithfully recorded, but the recording canvas' current clip will |
| 94 only see the path's bounds. This speeds up the recording process | 94 only see the path's bounds. This speeds up the recording process |
| 95 without compromising the fidelity of the playback. The only side- | 95 without compromising the fidelity of the playback. The only side- |
| 96 effect for recording is that calling getTotalClip() or related | 96 effect for recording is that calling getTotalClip() or related |
| 97 clip-query calls will reflect the path's bounds, not the actual | 97 clip-query calls will reflect the path's bounds, not the actual |
| 98 path. | 98 path. |
| 99 */ | 99 */ |
| 100 kUsePathBoundsForClip_RecordingFlag = 0x01, | 100 kUsePathBoundsForClip_RecordingFlag = 0x01, |
| 101 /* This flag causes the picture to compute bounding boxes and build | 101 /** This flag causes the picture to compute bounding boxes and build |
| 102 up a spatial hierarchy (currently an R-Tree), plus a tree of Canvas' | 102 up a spatial hierarchy (currently an R-Tree), plus a tree of Canvas' |
| 103 usually stack-based clip/etc state. This requires an increase in | 103 usually stack-based clip/etc state. This requires an increase in |
| 104 recording time (often ~2x; likely more for very complex pictures), | 104 recording time (often ~2x; likely more for very complex pictures), |
| 105 but allows us to perform much faster culling at playback time, and | 105 but allows us to perform much faster culling at playback time, and |
| 106 completely avoid some unnecessary clips and other operations. This | 106 completely avoid some unnecessary clips and other operations. This |
| 107 is ideal for tiled rendering, or any other situation where you're | 107 is ideal for tiled rendering, or any other situation where you're |
| 108 drawing a fraction of a large scene into a smaller viewport. | 108 drawing a fraction of a large scene into a smaller viewport. |
| 109 | 109 |
| 110 In most cases the record cost is offset by the playback improvement | 110 In most cases the record cost is offset by the playback improvement |
| 111 after a frame or two of tiled rendering (and complex pictures that | 111 after a frame or two of tiled rendering (and complex pictures that |
| 112 induce the worst record times will generally get the largest | 112 induce the worst record times will generally get the largest |
| 113 speedups at playback time). | 113 speedups at playback time). |
| 114 | 114 |
| 115 Note: Currently this is not serializable, the bounding data will be | 115 Note: Currently this is not serializable, the bounding data will be |
| 116 discarded if you serialize into a stream and then deserialize. | 116 discarded if you serialize into a stream and then deserialize. |
| 117 */ | 117 */ |
| 118 kOptimizeForClippedPlayback_RecordingFlag = 0x02 | 118 kOptimizeForClippedPlayback_RecordingFlag = 0x02, |
| 119 /** This flag causes device-space bounding boxes to be stored for |
| 120 each canvas call that writes pixels. Encoding this information |
| 121 enables several playback optimizations. |
| 122 */ |
| 123 kRecordBounds_RecordingFlag = 0x04 |
| 119 }; | 124 }; |
| 120 | 125 |
| 121 /** Returns the canvas that records the drawing commands. | 126 /** Returns the canvas that records the drawing commands. |
| 122 @param width the base width for the picture, as if the recording | 127 @param width the base width for the picture, as if the recording |
| 123 canvas' bitmap had this width. | 128 canvas' bitmap had this width. |
| 124 @param height the base width for the picture, as if the recording | 129 @param height the base width for the picture, as if the recording |
| 125 canvas' bitmap had this height. | 130 canvas' bitmap had this height. |
| 126 @param recordFlags optional flags that control recording. | 131 @param recordFlags optional flags that control recording. |
| 127 @return the picture canvas. | 132 @return the picture canvas. |
| 128 */ | 133 */ |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 */ | 236 */ |
| 232 SkCanvas* getRecordingCanvas() const { return fCanvas; } | 237 SkCanvas* getRecordingCanvas() const { return fCanvas; } |
| 233 | 238 |
| 234 private: | 239 private: |
| 235 SkPicture* fPicture; | 240 SkPicture* fPicture; |
| 236 SkCanvas* fCanvas; | 241 SkCanvas* fCanvas; |
| 237 }; | 242 }; |
| 238 | 243 |
| 239 | 244 |
| 240 #endif | 245 #endif |
| OLD | NEW |