Struct CpuSurface
pub struct CpuSurface { /* private fields */ }Expand description
A surface’s frames kept in memory and drawn on the CPU: what a host shows on a machine where the toolkit has no GPU adapter to draw them on, exactly as it draws a normal app’s frame there. Kept between frames, so damage costs only what it changed.
Implementations§
§impl CpuSurface
impl CpuSurface
pub fn new(width: u32, height: u32, threads: u16) -> Option<CpuSurface>
pub fn new(width: u32, height: u32, threads: u16) -> Option<CpuSurface>
A surface of width x height pixels, rasterized with up to
threads cores, or None where this build has no CPU rasterizer.
pub fn draw(
&mut self,
scene: &Scene,
damage: Option<&[(u32, u32, u32, u32)]>,
) -> Option<Vec<(u32, u32, u32, u32)>>
pub fn draw( &mut self, scene: &Scene, damage: Option<&[(u32, u32, u32, u32)]>, ) -> Option<Vec<(u32, u32, u32, u32)>>
Draw scene (physical pixels) over the pixels already here, in the
damage regions of the surface as (x, y, width, height); the first
draw covers all of it, and a surface draws nothing outside its own
pixels. Returns the regions drawn, or None where no pixel changed.
The regions drawn are the ones this rasterizer saw its prepared
scenes differ in ([tilo_cpu_raster::CpuRasterizer::changes]): the
pixels are its own and it keeps the frame before, so it proves what a
caller cannot, more finely than damage says and for nothing when
nothing changed. Pixels that only moved, as they do in a strip that
slides, are moved rather than drawn. damage is what the caller knows
of the change, drawn where that proof is too large to list, and a
change listed in more places than [MAX_REGIONS] is drawn in the
region they cover.
Auto Trait Implementations§
impl Freeze for CpuSurface
impl !RefUnwindSafe for CpuSurface
impl Send for CpuSurface
impl !Sync for CpuSurface
impl Unpin for CpuSurface
impl UnsafeUnpin for CpuSurface
impl !UnwindSafe for CpuSurface
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more