Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: include/core/SkPicture.h

Issue 12545009: Adding option in SkPicture to record device-space bounds of draw commands. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkPicture.cpp » ('j') | src/core/SkPicturePlayback.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }; 119 };
120 120
121 /** Returns the canvas that records the drawing commands. 121 /** Returns the canvas that records the drawing commands.
122 @param width the base width for the picture, as if the recording 122 @param width the base width for the picture, as if the recording
123 canvas' bitmap had this width. 123 canvas' bitmap had this width.
124 @param height the base width for the picture, as if the recording 124 @param height the base width for the picture, as if the recording
125 canvas' bitmap had this height. 125 canvas' bitmap had this height.
126 @param recordFlags optional flags that control recording. 126 @param recordFlags optional flags that control recording.
127 @return the picture canvas. 127 @return the picture canvas.
128 */ 128 */
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 */ 231 */
232 SkCanvas* getRecordingCanvas() const { return fCanvas; } 232 SkCanvas* getRecordingCanvas() const { return fCanvas; }
233 233
234 private: 234 private:
235 SkPicture* fPicture; 235 SkPicture* fPicture;
236 SkCanvas* fCanvas; 236 SkCanvas* fCanvas;
237 }; 237 };
238 238
239 239
240 #endif 240 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPicture.cpp » ('j') | src/core/SkPicturePlayback.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698