Skip to main content

DiscardScene

Struct DiscardScene 

Source
pub struct DiscardScene;
Expand description

A PaintScene sink that accepts every paint command and records nothing — the zero-GPU-cost target for a subtree that still needs its paint pass driven for the pass’s side effects (hero-rect reporting through PaintCtx::with_hero_registry, other paint-time widget state) even though its pixels will never be composited. The navigator’s transition machinery is the motivating case: a page whose resolved alpha is 0 still has to paint to report hero rects and advance animating children, but every command it emits is otherwise wasted GPU work.

§Guarantee

No paint command reaches any scene: every PaintScene method on DiscardScene is a no-op, whether overridden here directly or inherited from the trait’s own no-op (or no-op-delegating) default. Anything driven through PaintCtx rather than through &mut dyn PaintScene — the hero registry, the frame clock, paced-class bubbling — is unaffected, since none of that machinery routes through the scene it’s handed.

Trait Implementations§

Source§

impl PaintScene for DiscardScene

Source§

fn fill_rect(&mut self, _origin: Point, _size: Size, _color: Color)

Emit a filled axis-aligned rectangle at origin with size, filled with the solid color.
Source§

fn draw_text(&mut self, _origin: Point, _text: &str)

Emit a run of unshaped text anchored at origin. Read more
Source§

fn fill_rounded_rect( &mut self, _origin: Point, _size: Size, _radius: f64, _color: Color, )

Emit a filled axis-aligned rectangle with uniformly rounded corners. Read more
Source§

fn fill_rounded_rect_radii( &mut self, origin: Point, size: Size, radii: CornerRadii, color: Color, )

Emit a filled axis-aligned rectangle with per-corner radii — the shape a uniform PaintScene::fill_rounded_rect cannot express (a bottom-anchored sheet with only its top corners rounded, a segmented control’s end caps). Read more
Source§

fn stroke_line(&mut self, _p0: Point, _p1: Point, _width: f64, _color: Color)

Stroke a straight line from p0 to p1 with the given width and solid color. Read more
Source§

fn push_clip(&mut self, _origin: Point, _size: Size)

Push a rectangular clip (at origin/size) onto the backend clip stack; subsequent draws are clipped to it until the matching PaintScene::pop_clip. Read more
Source§

fn push_clip_rounded(&mut self, _origin: Point, _size: Size, _radius: f64)

Push a clip with uniformly rounded corners (at origin/size, corner radius) onto the backend clip stack; subsequent draws are clipped to the rounded shape until the matching PaintScene::pop_clip — the same pop PaintScene::push_clip uses, since there is one clip stack. Read more
Source§

fn push_clip_rounded_radii( &mut self, origin: Point, size: Size, radii: CornerRadii, )

Push a clip with per-corner radii onto the backend clip stack, popped by the same PaintScene::pop_clip as every other push. Read more
Source§

fn pop_clip(&mut self)

Pop the most recently pushed clip, rectangular or rounded. Defaulted to a no-op; see PaintScene::push_clip.
Source§

fn draw_glyph_run(&mut self, _run: GlyphRun)

Emit a run of already-shaped glyphs into the scene. Read more
Source§

fn draw_image(&mut self, _data: &ImageData, _dest: Rect)

Draw an already-decoded image, scaled from its natural (data.widthxdata.height) size to fill the absolute dest rect. Read more
Source§

fn draw_shader(&mut self, _program: &ShaderProgram, _dest: Rect, _time: f32)

Draw a fragment-shader-filled rectangle, scaled to fill dest. Read more
Source§

fn draw_scene_texture(&mut self, _id: u64, _dest: Rect)

Composite a bound scene texture (pre-rendered via ExternalPass) into the scene. Read more
Source§

fn draw_shadow( &mut self, _origin: Point, _size: Size, _radius: f64, _std_dev: f64, _color: Color, )

Draw a gaussian-blurred rounded-rectangle elevation shadow (an approximation of a CSS box-shadow) at origin/size. Read more
Source§

fn fill_rect_brush(&mut self, origin: Point, size: Size, brush: &Brush)

Emit a filled axis-aligned rectangle at origin with size, filled with an arbitrary brush (solid color or gradient). Read more
Source§

fn fill_rounded_rect_brush( &mut self, _origin: Point, _size: Size, _radius: f64, _brush: &Brush, )

Emit a filled axis-aligned rectangle with uniformly rounded corners, filled with an arbitrary brush (solid color or gradient). Read more
Source§

fn push_layer(&mut self, _origin: Point, _size: Size, _alpha: f32)

Push a translucent layer (at origin/size) onto the backend layer stack; subsequent draws are composited at alpha until the matching PaintScene::pop_layer. Read more
Source§

fn pop_layer(&mut self)

Pop the most recently pushed layer. Defaulted to a no-op; see PaintScene::push_layer.
Source§

fn clear_rect(&mut self, _origin: Point, _size: Size)

Clear an axis-aligned rectangle (at origin/size) to full transparency (alpha 0), erasing everything already painted below it in this scene — a real destination-clearing composite, not merely skipping paint over the region. Read more
Source§

fn fill_path(&mut self, _origin: Point, _path: &BezPath, _brush: &Brush)

Fill an arbitrary vector path (e.g. an arc — see frust_scene::arc_path) at origin, using the nonzero winding rule and brush. Read more
Source§

fn stroke_path( &mut self, _origin: Point, _path: &BezPath, _width: f64, _brush: &Brush, )

Stroke an arbitrary vector path (e.g. an arc) at origin with width and round caps/joins, using brush. Read more
Source§

fn stroke_path_dashed( &mut self, origin: Point, path: &BezPath, width: f64, _dash: DashPattern, brush: &Brush, )

Stroke an arbitrary vector path at origin as a dashed line: the same stroke PaintScene::stroke_path paints, broken into dash’s on/off runs by the render crate at encode time. Read more
Source§

fn push_transform(&mut self, _transform: Affine)

Push an affine transform, composed with the current one, onto the backend transform stack; subsequent draws are transformed until the matching PaintScene::pop_transform. Read more
Source§

fn pop_transform(&mut self)

Pop the most recently pushed transform, restoring the previous one. Defaulted to a no-op; see PaintScene::push_transform.
Source§

fn push_snapshot( &mut self, _key: u64, origin: Point, size: Size, alpha: f32, scale: f64, )

Push a snapshot bracket: the body is rasterizable once and cached by key across frames. The alpha and scale are presentation parameters applied to the whole cached body (alpha blending, uniform scale). Read more
Source§

fn pop_snapshot(&mut self)

Pop the most recently pushed snapshot bracket. Defaulted to the reverse of PaintScene::push_snapshot’s default: pop layer, then transform. Recorders that don’t override both may see unbalanced stacks if only one is overridden; the default pair is provided for source compatibility.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> StorageAccess<T> for T

Source§

fn as_borrowed(&self) -> &T

Borrows the value.
Source§

fn into_taken(self) -> T

Takes the value.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.