Function freya_engine::prelude::wrap_backend_render_target
pub fn wrap_backend_render_target(
context: &mut RCHandle<GrRecordingContext>,
backend_render_target: &Handle<GrBackendRenderTarget>,
origin: GrSurfaceOrigin,
color_type: ColorType,
color_space: impl Into<Option<RCHandle<SkColorSpace>>>,
surface_props: Option<&SurfaceProps>,
) -> Option<RCHandle<SkSurface>>
Expand description
Wraps a GPU-backed buffer into Surface
. Caller must ensure backend_render_target
is valid for the lifetime of returned Surface
.
Surface
is returned if all parameters are valid. backend_render_target
is valid if
its pixel configuration agrees with color_space
and context; for instance, if
backend_render_target
has an sRGB configuration, then context must support sRGB,
and color_space
must be present. Further, backend_render_target
width and height must
not exceed context capabilities, and the context must be able to support
back-end render targets.
context
- GPU contextbackend_render_target
- GPU intermediate memory bufferorigin
- origin of canvascolor_type
- type of colors in the buffercolor_space
- range of colorssurface_props
- LCD striping orientation and setting for device independent fonts; may beNone
Returns:Surface
if all parameters are valid; otherwise,None