mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-09 03:57:39 +00:00
Move back to sorting entries in the depth map as we insert them
This commit is contained in:
parent
101cedb5f7
commit
11b433dc1c
1 changed files with 10 additions and 6 deletions
|
@ -375,10 +375,14 @@ impl Frame {
|
||||||
// Reuse entries in the depth map that didn't change since the last frame.
|
// Reuse entries in the depth map that didn't change since the last frame.
|
||||||
for (order, view_id, bounds) in prev_frame.depth_map.drain(..) {
|
for (order, view_id, bounds) in prev_frame.depth_map.drain(..) {
|
||||||
if self.reused_views.contains(&view_id) {
|
if self.reused_views.contains(&view_id) {
|
||||||
self.depth_map.push((order, view_id, bounds));
|
match self
|
||||||
|
.depth_map
|
||||||
|
.binary_search_by(|(level, _, _)| order.cmp(level))
|
||||||
|
{
|
||||||
|
Ok(i) | Err(i) => self.depth_map.insert(i, (order, view_id, bounds)),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.depth_map.sort_by(|a, b| a.0.cmp(&b.0));
|
|
||||||
|
|
||||||
// Retain element states for views that didn't change since the last frame.
|
// Retain element states for views that didn't change since the last frame.
|
||||||
for (element_id, state) in prev_frame.element_states.drain() {
|
for (element_id, state) in prev_frame.element_states.drain() {
|
||||||
|
@ -1052,10 +1056,10 @@ impl<'a> WindowContext<'a> {
|
||||||
pub fn add_opaque_layer(&mut self, bounds: Bounds<Pixels>) {
|
pub fn add_opaque_layer(&mut self, bounds: Bounds<Pixels>) {
|
||||||
let stacking_order = self.window.next_frame.z_index_stack.clone();
|
let stacking_order = self.window.next_frame.z_index_stack.clone();
|
||||||
let view_id = self.parent_view_id();
|
let view_id = self.parent_view_id();
|
||||||
self.window
|
let depth_map = &mut self.window.next_frame.depth_map;
|
||||||
.next_frame
|
match depth_map.binary_search_by(|(level, _, _)| stacking_order.cmp(level)) {
|
||||||
.depth_map
|
Ok(i) | Err(i) => depth_map.insert(i, (stacking_order, view_id, bounds)),
|
||||||
.push((stacking_order, view_id, bounds));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if there is no opaque layer containing the given point
|
/// Returns true if there is no opaque layer containing the given point
|
||||||
|
|
Loading…
Reference in a new issue