Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkPictureRecorder Class Reference
Inheritance diagram for SkPictureRecorder:

Public Types

enum  RecordFlags { kPlaybackDrawPicture_RecordFlag = 1 << 0 }
 
enum  FinishFlags
 

Public Member Functions

SkCanvasbeginRecording (const SkRect &bounds, SkBBHFactory *bbhFactory=NULL, uint32_t recordFlags=0)
 Returns the canvas that records the drawing commands. More...
 
SkCanvasbeginRecording (SkScalar width, SkScalar height, SkBBHFactory *bbhFactory=NULL, uint32_t recordFlags=0)
 
SkCanvasgetRecordingCanvas ()
 Returns the recording canvas if one is active, or NULL if recording is not active. More...
 
sk_sp< SkPicturefinishRecordingAsPicture (uint32_t endFlags=0)
 Signal that the caller is done recording. More...
 
sk_sp< SkPicturefinishRecordingAsPictureWithCull (const SkRect &cullRect, uint32_t endFlags=0)
 Signal that the caller is done recording, and update the cull rect to use for bounding box hierarchy (BBH) generation. More...
 
sk_sp< SkDrawablefinishRecordingAsDrawable (uint32_t endFlags=0)
 Signal that the caller is done recording. More...
 

Private Types

typedef SkNoncopyable INHERITED
 

Private Member Functions

void reset ()
 
void partialReplay (SkCanvas *canvas) const
 

Private Attributes

bool fActivelyRecording
 
uint32_t fFlags
 
SkRect fCullRect
 
sk_sp< SkBBoxHierarchy > fBBH
 
std::unique_ptr< SkRecorder > fRecorder
 
sk_sp< SkRecord > fRecord
 
std::unique_ptr< SkMiniRecorder > fMiniRecorder
 

Friends

class SkPictureRecorderReplayTester
 Replay the current (partially recorded) operation stream into canvas. More...
 

Member Function Documentation

SkCanvas* SkPictureRecorder::beginRecording ( const SkRect bounds,
SkBBHFactory bbhFactory = NULL,
uint32_t  recordFlags = 0 
)

Returns the canvas that records the drawing commands.

Parameters
boundsthe cull rect used when recording this picture. Any drawing the falls outside of this rect is undefined, and may be drawn or it may not.
bbhFactoryfactory to create desired acceleration structure
recordFlagsoptional flags that control recording.
Returns
the canvas.
sk_sp<SkDrawable> SkPictureRecorder::finishRecordingAsDrawable ( uint32_t  endFlags = 0)

Signal that the caller is done recording.

This invalidates the canvas returned by beginRecording/getRecordingCanvas. Ownership of the object is passed to the caller, who must call unref() when they are done using it.

Unlike finishRecordingAsPicture(), which returns an immutable picture, the returned drawable may contain live references to other drawables (if they were added to the recording canvas) and therefore this drawable will reflect the current state of those nested drawables anytime it is drawn or a new picture is snapped from it (by calling drawable->newPictureSnapshot()).

sk_sp<SkPicture> SkPictureRecorder::finishRecordingAsPicture ( uint32_t  endFlags = 0)

Signal that the caller is done recording.

This invalidates the canvas returned by beginRecording/getRecordingCanvas. Ownership of the object is passed to the caller, who must call unref() when they are done using it.

The returned picture is immutable. If during recording drawables were added to the canvas, these will have been "drawn" into a recording canvas, so that this resulting picture will reflect their current state, but will not contain a live reference to the drawables themselves.

sk_sp<SkPicture> SkPictureRecorder::finishRecordingAsPictureWithCull ( const SkRect cullRect,
uint32_t  endFlags = 0 
)

Signal that the caller is done recording, and update the cull rect to use for bounding box hierarchy (BBH) generation.

The behavior is the same as calling finishRecordingAsPicture(), except that this method updates the cull rect initially passed into beginRecording.

Parameters
cullRectthe new culling rectangle to use as the overall bound for BBH generation and subsequent culling operations.
Returns
the picture containing the recorded content.
SkCanvas* SkPictureRecorder::getRecordingCanvas ( )

Returns the recording canvas if one is active, or NULL if recording is not active.

This does not alter the refcnt on the canvas (if present).

Friends And Related Function Documentation

friend class SkPictureRecorderReplayTester
friend

Replay the current (partially recorded) operation stream into canvas.

This call doesn't close the current recording.


The documentation for this class was generated from the following file: