MCPcopy Create free account
hub / github.com/donkeyteethUX/iced_plot / prepare_frame

Method prepare_frame

src/plot_renderer/shader.rs:544–574  ·  view source on GitHub ↗

Prepare the renderer for a new frame given the viewport and current plot state. This sets format/viewport/scale, ensures pipelines and grid, and syncs buffers.

(
        &mut self,
        device: &Device,
        queue: &Queue,
        viewport: &Viewport,
        bounds: &Rectangle,
        state: &PlotState,
    )

Source from the content-addressed store, hash-verified

542 // Selection is rebuilt whenever it's active.
543 self.rebuild_selection(device, queue, state);
544
545 // Hover/pick highlight mask boxes are baked in clip space, so they must be rebuilt
546 // whenever the camera or viewport changes (zoom/pan/resize), not only when the
547 // highlighted points change.
548 if state.highlight_version != self.versions.highlight || offset_changed {
549 self.rebuild_highlight(device, queue, state);
550 self.versions.highlight = state.highlight_version;
551 }
552
553 // Crosshairs are rebuilt every frame when enabled.
554 self.rebuild_crosshairs(device, queue, state);
555 }
556
557 /// Prepare the renderer for a new frame given the viewport and current plot state.
558 /// This sets format/viewport/scale, ensures pipelines and grid, and syncs buffers.
559 pub(crate) fn prepare_frame(
560 &mut self,
561 device: &Device,
562 queue: &Queue,
563 viewport: &Viewport,
564 bounds: &Rectangle,
565 state: &PlotState,
566 ) {
567 self.bounds = *bounds;
568 let scale_factor = viewport.scale_factor();
569 let bounds_width = (bounds.width * scale_factor) as u32;
570 let bounds_height = (bounds.height * scale_factor) as u32;
571 let viewport_size = viewport.physical_size();
572
573 self.set_bounds(bounds_width, bounds_height);
574 self.set_scale_factor(scale_factor);
575 // In-pass path (MSAA=1, Android) never runs `encode`, so the offscreen
576 // MSAA/resolve textures would only waste memory; `encode` self-guards
577 // by early-returning when `msaa_targets` is `None`.

Callers 1

prepareMethod · 0.80

Calls 7

set_scale_factorMethod · 0.80
ensure_msaa_targetsMethod · 0.80
set_viewMethod · 0.80
syncMethod · 0.80
set_boundsMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected