Flutter Engine
The Flutter Engine
|
#include <MSKPPlayer.h>
Classes | |
struct | Cmd |
class | CmdRecordCanvas |
struct | DrawLayerCmd |
struct | PicCmd |
Public Member Functions | |
~MSKPPlayer () | |
SkISize | maxDimensions () const |
int | numFrames () const |
SkISize | frameDimensions (int i) const |
bool | playFrame (SkCanvas *canvas, int i) |
void | resetLayers () |
void | rewindLayers () |
void | allocateLayers (SkCanvas *) |
std::vector< int > | layerIDs (int frame=-1) const |
sk_sp< SkImage > | layerSnapshot (int layerID) const |
Static Public Member Functions | |
static std::unique_ptr< MSKPPlayer > | Make (SkStreamSeekable *stream) |
Plays frames/pages of a MSKP to a canvas. This class uses the term "frame" as though the MSKP contains an animation, though it could indeed contain pages of a static document.
Definition at line 27 of file MSKPPlayer.h.
|
default |
void MSKPPlayer::allocateLayers | ( | SkCanvas * | canvas | ) |
Creates backing stores for any offscreen layers using the passed canvas's makeSurface(). Existing layers that match the canvas's recording context are not reallocated or rewound.
Definition at line 467 of file MSKPPlayer.cpp.
Size of an individual frame.
Definition at line 417 of file MSKPPlayer.cpp.
A set of IDs of offscreen layers in no particular order. If frame value >= 0 is specified then the layer set is filtered to layers used by that frame (or empty if >= numFrames). If < 0 then gathers all the layers across all frames.
Definition at line 479 of file MSKPPlayer.cpp.
Gets the contents of an offscreen layer. It's contents will depend on current playback state (playFrame(), updateFrameLayers(), resetLayers()). If the layer currently has no backing store because it hasn't been drawn or resetLayers() was called then this will return nullptr. Layer contents are not affected by rewindLayers() as that simply lazily redraws the frame contents the next time it is required by playFrame*() or updateFrameLayers().
Definition at line 494 of file MSKPPlayer.cpp.
|
static |
Make a player from a MSKP stream, or null if stream can't be read as MSKP.
Definition at line 386 of file MSKPPlayer.cpp.
|
inline |
Maximum width and height across all frames.
Definition at line 35 of file MSKPPlayer.h.
|
inline |
Total number of frames.
Definition at line 38 of file MSKPPlayer.h.
Plays a frame into the passed canvas. Frames can be randomly accessed. Offscreen layers are incrementally updated from their current state to the state required for the frame (redrawing from scratch if their current state is ahead of the passed frame index).
Definition at line 424 of file MSKPPlayer.cpp.
void MSKPPlayer::resetLayers | ( | ) |
Destroys any cached offscreen layers.
Definition at line 459 of file MSKPPlayer.cpp.
void MSKPPlayer::rewindLayers | ( | ) |
Forces all offscreen layers to re-render the next time they're required for a frame but preserves the backing stores for them if already allocated.
Definition at line 461 of file MSKPPlayer.cpp.