1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-03 07:10:04 -04:00

Use a ViewportIdSet

This commit is contained in:
Emil Ernerfeldt
2023-11-07 19:19:45 +01:00
parent a3b02002ea
commit 701301efc2
2 changed files with 4 additions and 3 deletions

View File

@@ -1459,7 +1459,7 @@ impl Context {
pub fn end_frame(&self) -> FullOutput { pub fn end_frame(&self) -> FullOutput {
crate::profile_function!(); crate::profile_function!();
let mut viewports: Vec<ViewportId> = self.write(|ctx| { let mut viewports: ViewportIdSet = self.write(|ctx| {
ctx.layer_rects_prev_frame.insert( ctx.layer_rects_prev_frame.insert(
ctx.viewport_id(), ctx.viewport_id(),
ctx.layer_rects_this_frame ctx.layer_rects_this_frame
@@ -1468,7 +1468,7 @@ impl Context {
); );
ctx.viewports.values().map(|vp| vp.id_pair.this).collect() ctx.viewports.values().map(|vp| vp.id_pair.this).collect()
}); });
viewports.push(ViewportId::ROOT); viewports.insert(ViewportId::ROOT);
if self.input(|i| i.wants_repaint()) { if self.input(|i| i.wants_repaint()) {
self.request_repaint(); self.request_repaint();

View File

@@ -6,6 +6,7 @@ use crate::{
area, area,
window::{self, WindowInteraction}, window::{self, WindowInteraction},
EventFilter, Id, IdMap, InputState, LayerId, Pos2, Rect, Style, ViewportId, ViewportIdMap, EventFilter, Id, IdMap, InputState, LayerId, Pos2, Rect, Style, ViewportId, ViewportIdMap,
ViewportIdSet,
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -561,7 +562,7 @@ impl Memory {
pub(crate) fn end_frame( pub(crate) fn end_frame(
&mut self, &mut self,
input: &InputState, input: &InputState,
viewports: &[ViewportId], viewports: &ViewportIdSet,
used_ids: &IdMap<Rect>, used_ids: &IdMap<Rect>,
) { ) {
self.caches.update(); self.caches.update();