pub trait PlatformRenderer: NativeSceneHooks {
// Required methods
fn update_drawable_size(&mut self, size: Size<DevicePixels>);
fn max_texture_size(&self) -> u32;
fn gpu_specs(&self) -> Option<GpuSpecs>;
// Provided methods
fn set_subpixel_layout(&mut self, _is_bgr: bool) { ... }
fn update_transparency(&mut self, _transparent: bool) { ... }
fn destroy(&mut self) { ... }
fn device_lost(&self) -> bool { ... }
fn needs_redraw(&mut self) -> bool { ... }
fn recover(&mut self, _target: RendererTarget<'_>) -> Result<()> { ... }
}Expand description
What a window asks of whatever renders into it.
draw and sprite_atlas come from SceneRenderer; this adds the lifecycle a window
drives, which an offscreen renderer has no reason to implement. update_drawable_size and
max_texture_size are the two with no default, because a renderer that cannot answer them
cannot be a window’s.
Required Methods§
Sourcefn update_drawable_size(&mut self, size: Size<DevicePixels>)
fn update_drawable_size(&mut self, size: Size<DevicePixels>)
The target’s size changed, in device pixels.
Sourcefn max_texture_size(&self) -> u32
fn max_texture_size(&self) -> u32
The largest texture this renderer can allocate, in pixels.
Provided Methods§
Sourcefn set_subpixel_layout(&mut self, _is_bgr: bool)
fn set_subpixel_layout(&mut self, _is_bgr: bool)
Whether glyphs are rasterized with subpixel antialiasing in BGR order.
Sourcefn update_transparency(&mut self, _transparent: bool)
fn update_transparency(&mut self, _transparent: bool)
The window’s transparency changed.
Sourcefn device_lost(&self) -> bool
fn device_lost(&self) -> bool
Whether the GPU device or its surface has been lost.
Sourcefn needs_redraw(&mut self) -> bool
fn needs_redraw(&mut self) -> bool
Whether the renderer has work the frame loop should not wait on.
Sourcefn recover(&mut self, _target: RendererTarget<'_>) -> Result<()>
fn recover(&mut self, _target: RendererTarget<'_>) -> Result<()>
Rebuild from the target the renderer was built against, after a lost device or surface.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".