pub struct ViewportState { /* private fields */ }Expand description
What the widget keeps between frames. One per viewport; the application owns it.
Implementations§
Source§impl ViewportState
impl ViewportState
Sourcepub fn new() -> ViewportState
pub fn new() -> ViewportState
An empty state.
Sourcepub fn in_gesture(&self) -> bool
pub fn in_gesture(&self) -> bool
Whether a gesture is in progress.
Sourcepub fn set_display_transform(&mut self, transform: Arc<dyn DisplayTransform>)
pub fn set_display_transform(&mut self, transform: Arc<dyn DisplayTransform>)
Replaces the display transform (the application’s colour
management; LinearSrgb by default).
Sourcepub fn display_transform(&self) -> &Arc<dyn DisplayTransform>
pub fn display_transform(&self) -> &Arc<dyn DisplayTransform>
The display transform in use.
Sourcepub fn display_target(&self) -> Option<DisplayTarget>
pub fn display_target(&self) -> Option<DisplayTarget>
The display target the last frame was drawn for.
Sourcepub fn display_resolution(&self) -> Option<&Resolution>
pub fn display_resolution(&self) -> Option<&Resolution>
What the last frame was drawn for: the wanted target, the surface’s, the one drawn and why it carries less, if it does.
Sourcepub fn sink(&self) -> TileSink
pub fn sink(&self) -> TileSink
Where the source delivers the image’s tiles (give it to the source when making it).
Sourcepub fn before_sink(&self) -> TileSink
pub fn before_sink(&self) -> TileSink
Where a second source delivers the “before” image of a comparison.
Sourcepub fn notices_waiting(&self) -> usize
pub fn notices_waiting(&self) -> usize
Sourcepub fn tiles_complete(&self) -> bool
pub fn tiles_complete(&self) -> bool
No request outstanding and every wanted exact tile on screen (after the last frame).
Sourcepub fn outstanding(&self) -> usize
pub fn outstanding(&self) -> usize
Requests waiting for an answer.
Sourcepub fn tile_count(&self) -> usize
pub fn tile_count(&self) -> usize
Tiles held.
Sourcepub fn texture_bytes(&self) -> usize
pub fn texture_bytes(&self) -> usize
Bytes of tile textures held.
Sourcepub fn set_tile_size(&mut self, side: u32)
pub fn set_tile_size(&mut self, side: u32)
The side of a tile wanted, in pixels (256 by default; the device’s largest texture side at most).
Sourcepub fn set_texture_budget(&mut self, bytes: usize)
pub fn set_texture_budget(&mut self, bytes: usize)
The texture budget, in bytes (256 MB by default). Tiles drawn in the current frame are never evicted, so a view larger than the budget still shows whole.
Sourcepub fn set_upload_budget(&mut self, budget: UploadBudget)
pub fn set_upload_budget(&mut self, budget: UploadBudget)
How much one frame uploads at most (UploadBudget::DEFAULT, 8
MiB, by default). Tiles over it wait for the next frames, the
visible area’s first, and are kept when the view moves.
UploadBudget::UNLIMITED opts out: every tile arrived goes up
in the frame that takes it in.
Sourcepub fn upload_budget(&self) -> UploadBudget
pub fn upload_budget(&self) -> UploadBudget
The upload budget.
Sourcepub fn set_prepare_on_worker(&mut self, on: bool)
pub fn set_prepare_on_worker(&mut self, on: bool)
Converts tiles on the thread that delivers them (the source’s
worker) instead of the interface thread: the display transform
of the CPU path, the half-float texels of the GPU path. On by
default: the source’s thread runs the display transform
(DisplayTransform is Send + Sync), and a tile converted
with a transform replaced meanwhile is shown, marked stale and
asked for again. false opts out: the interface thread converts
each tile when it takes it in, for a source whose threads must
not run the transform, or one delivering from the interface
thread anyway (the conversion then happens there either way).
See docs/threading.md for the measurements.
Sourcepub fn prepare_on_worker(&self) -> bool
pub fn prepare_on_worker(&self) -> bool
Whether tiles are converted on the delivering thread.
Sourcepub fn upload_report(&self) -> UploadReport
pub fn upload_report(&self) -> UploadReport
What the last frame uploaded, and what waits.
Sourcepub fn transfers(&self) -> Transfers
pub fn transfers(&self) -> Transfers
Tile pixels copied to the GPU since the state was made, counted where the copy happens (up to the last paint); device tiles count as bound, with no byte.
Sourcepub fn frame_transfers(&self) -> Transfers
pub fn frame_transfers(&self) -> Transfers
What the last whole frame copied, its paint included: from the start of the frame before the last one to the start of the last one. Zero bytes on a view drawn from device tiles alone.
Sourcepub fn last_error(&self) -> Option<&str>
pub fn last_error(&self) -> Option<&str>
The last error about tiles: one a source reported
(TileSink::failed), or a
device tile refused and why.
Sourcepub fn set_settle(&mut self, seconds: f64)
pub fn set_settle(&mut self, seconds: f64)
How long the view stays still before exact tiles are asked for, in seconds (0.1 by default; 0 asks at once).
Sourcepub fn loupe_mut(&mut self) -> &mut Loupe
pub fn loupe_mut(&mut self) -> &mut Loupe
The loupe’s settings, to change (turn it on for a tool, change its magnification).
Sourcepub fn loupe_frame(&self) -> Option<&LoupeFrame>
pub fn loupe_frame(&self) -> Option<&LoupeFrame>
What the loupe showed in the last frame, if it showed.
Sourcepub fn cursor(&self) -> Option<&Cursor>
pub fn cursor(&self) -> Option<&Cursor>
The cursor resolved for the pointer in the last frame (after the
on_cursor hook), while the pointer is over the viewport.
Sourcepub fn cursor_shown(&self) -> Option<&Shown>
pub fn cursor_shown(&self) -> Option<&Shown>
What the cursor showed in the last frame, while the pointer is over the viewport.
Sourcepub fn refresh_cursor(&mut self)
pub fn refresh_cursor(&mut self)
Forgets the cursor resolved, so the next frame asks the
on_cursor hook again (its answer changed for the same
situation).
Sourcepub fn trace(&self) -> impl Iterator<Item = &TraceEntry>
pub fn trace(&self) -> impl Iterator<Item = &TraceEntry>
What the hooks decided lately, oldest first.
Sourcepub fn propose(&mut self, view: &mut View, to: View) -> bool
pub fn propose(&mut self, view: &mut View, to: View) -> bool
Changes the view from outside the widget (a menu’s “zoom in”),
through the before_view hook like a gesture. Returns whether the
view changed; the signal comes with the next frame’s output.
Trait Implementations§
Source§impl Debug for ViewportState
impl Debug for ViewportState
Source§impl Default for ViewportState
impl Default for ViewportState
Source§fn default() -> ViewportState
fn default() -> ViewportState
Auto Trait Implementations§
impl Freeze for ViewportState
impl !RefUnwindSafe for ViewportState
impl !Send for ViewportState
impl !Sync for ViewportState
impl Unpin for ViewportState
impl UnsafeUnpin for ViewportState
impl !UnwindSafe for ViewportState
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> 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§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.