Clean up shared UI runtime state
This commit is contained in:
1 parent
9b4c690916
commit
5ca244528f
27 files changed
+355
-499
No files matched your search
@@ -32,7 +32,7 @@ fn entry_node(entry: &Entry) -> Node {
|
||||
/// Owns the last tree pushed out, so `update` can tell "nothing
|
||||
/// accessibility-relevant changed" from "something did" without asking
|
||||
/// the platform adapter to diff two `Node`s itself. One of these per
|
||||
/// window/view -- `default::DefaultUiState` and `android::AndroidUiState`
|
||||
/// window/view -- `desktop::DesktopUiState` and `android::AndroidUiState`
|
||||
/// each keep one.
|
||||
#[derive(Default)]
|
||||
pub struct AccessTree {
|
||||
|
||||
@@ -18,6 +18,14 @@ pub enum RedrawKind {
|
||||
Updates,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub struct RenderCounters {
|
||||
pub draws: u64,
|
||||
pub region_rewrites: u64,
|
||||
pub moves: u64,
|
||||
pub shapes: u64,
|
||||
}
|
||||
|
||||
pub struct UiRenderState {
|
||||
pub active: HashMap<WidgetId, ActiveData>,
|
||||
pub primitives: Primitives,
|
||||
@@ -115,13 +123,13 @@ impl UiRenderState {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn take_counters(&mut self) -> (u64, u64, u64, u64) {
|
||||
(
|
||||
std::mem::take(&mut self.draw_count),
|
||||
std::mem::take(&mut self.region_mut_count),
|
||||
std::mem::take(&mut self.mov_count),
|
||||
std::mem::take(&mut self.shape_count),
|
||||
)
|
||||
pub fn take_counters(&mut self) -> RenderCounters {
|
||||
RenderCounters {
|
||||
draws: std::mem::take(&mut self.draw_count),
|
||||
region_rewrites: std::mem::take(&mut self.region_mut_count),
|
||||
moves: std::mem::take(&mut self.mov_count),
|
||||
shapes: std::mem::take(&mut self.shape_count),
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn note_move(&mut self) {
|
||||
|
||||
Reference in new issue
Block a user