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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // will be ready to be parsed to create an SkPicturePlayback. | 246 // will be ready to be parsed to create an SkPicturePlayback. |
247 // If false is returned, SkPictInfo is unmodified. | 247 // If false is returned, SkPictInfo is unmodified. |
248 static bool StreamIsSKP(SkStream*, SkPictInfo*); | 248 static bool StreamIsSKP(SkStream*, SkPictInfo*); |
249 private: | 249 private: |
250 friend class SkFlatPicture; | 250 friend class SkFlatPicture; |
251 friend class SkPicturePlayback; | 251 friend class SkPicturePlayback; |
252 | 252 |
253 typedef SkRefCnt INHERITED; | 253 typedef SkRefCnt INHERITED; |
254 }; | 254 }; |
255 | 255 |
256 class SkAutoPictureRecord : SkNoncopyable { | |
257 public: | |
258 SkAutoPictureRecord(SkPicture* pict, int width, int height, | |
259 uint32_t recordingFlags = 0) { | |
260 fPicture = pict; | |
261 fCanvas = pict->beginRecording(width, height, recordingFlags); | |
262 } | |
263 ~SkAutoPictureRecord() { | |
264 fPicture->endRecording(); | |
265 } | |
266 | |
267 /** Return the canvas to draw into for recording into the picture. | |
268 */ | |
269 SkCanvas* getRecordingCanvas() const { return fCanvas; } | |
270 | |
271 private: | |
272 SkPicture* fPicture; | |
273 SkCanvas* fCanvas; | |
274 }; | |
275 | |
276 /** | 256 /** |
277 * Subclasses of this can be passed to canvas.drawPicture. During the drawing | 257 * Subclasses of this can be passed to canvas.drawPicture. During the drawing |
278 * of the picture, this callback will periodically be invoked. If its | 258 * of the picture, this callback will periodically be invoked. If its |
279 * abortDrawing() returns true, then picture playback will be interrupted. | 259 * abortDrawing() returns true, then picture playback will be interrupted. |
280 * | 260 * |
281 * The resulting drawing is undefined, as there is no guarantee how often the | 261 * The resulting drawing is undefined, as there is no guarantee how often the |
282 * callback will be invoked. If the abort happens inside some level of nested | 262 * callback will be invoked. If the abort happens inside some level of nested |
283 * calls to save(), restore will automatically be called to return the state | 263 * calls to save(), restore will automatically be called to return the state |
284 * to the same level it was before the drawPicture call was made. | 264 * to the same level it was before the drawPicture call was made. |
285 */ | 265 */ |
286 class SK_API SkDrawPictureCallback { | 266 class SK_API SkDrawPictureCallback { |
287 public: | 267 public: |
288 SkDrawPictureCallback() {} | 268 SkDrawPictureCallback() {} |
289 virtual ~SkDrawPictureCallback() {} | 269 virtual ~SkDrawPictureCallback() {} |
290 | 270 |
291 virtual bool abortDrawing() = 0; | 271 virtual bool abortDrawing() = 0; |
292 }; | 272 }; |
293 | 273 |
294 #endif | 274 #endif |
OLD | NEW |