Flutter Engine
The Flutter Engine
|
#include <SkCanvasStateUtils.h>
Static Public Member Functions | |
static SkCanvasState * | CaptureCanvasState (SkCanvas *canvas) |
static std::unique_ptr< SkCanvas > | MakeFromCanvasState (const SkCanvasState *state) |
static void | ReleaseCanvasState (SkCanvasState *state) |
A set of functions that are useful for copying the state of an SkCanvas across a library boundary where the Skia library on the other side of the boundary may be newer. The expected usage is outline below...
Lib Boundary
CaptureCanvasState(...) ||| SkCanvas --> SkCanvasState ||| ||| CreateFromCanvasState(...) ||| SkCanvasState --> SkCanvas ||| Draw into SkCanvas
||| Unref SkCanvas` ReleaseCanvasState(...) |||
Definition at line 33 of file SkCanvasStateUtils.h.
|
static |
Captures the current state of the canvas into an opaque ptr that is safe to pass to a different instance of Skia (which may be the same version, or may be newer). The function will return NULL in the event that one of the following conditions are true. 1) the canvas device type is not supported (currently only raster is supported) 2) the canvas clip type is not supported (currently only non-AA clips are supported)
It is recommended that the original canvas also not be used until all canvases that have been created using its captured state have been dereferenced.
Finally, it is important to note that any draw filters attached to the canvas are NOT currently captured.
canvas | The canvas you wish to capture the current state of. |
Definition at line 178 of file SkCanvasStateUtils.cpp.
|
static |
Create a new SkCanvas from the captured state of another SkCanvas. The function will return NULL in the event that one of the following conditions are true. 1) the captured state is in an unrecognized format 2) the captured canvas device type is not supported
state | Opaque object created by CaptureCanvasState. |
Definition at line 299 of file SkCanvasStateUtils.cpp.
|
static |
Free the memory associated with the captured canvas state. The state should not be released until all SkCanvas objects created using that state have been dereferenced. Must be called from the same library instance that created the state via CaptureCanvasState.
state | The captured state you wish to dispose of. |
Definition at line 332 of file SkCanvasStateUtils.cpp.