Move unmap snapshot from Mapped to Tile
Browse files at this commit365dbacae7ed9b6dcee2c9a9281e9a531b842007Parent: af9caa17 changed files +129 -114
- niri-visual-tests/src/test_window.rs +0 -4
- src/handlers/compositor.rs +2 -1
- src/handlers/xdg_shell.rs +6 -7
- src/layout/mod.rs +48 -6
- src/layout/tile.rs +46 -76
- src/layout/workspace.rs +27 -3
- src/window/mapped.rs +0 -17
niri-visual-tests/src/test_window.rsmodified+0 -4
| @@ -227,10 +227,6 @@ impl LayoutElement for TestWindow { | |||
| 227 | &EMPTY | 227 | &EMPTY |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | - fn take_unmap_snapshot(&self) -> Option<LayoutElementRenderSnapshot> { | ||
| 231 | - None | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> { | 230 | fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> { |
| 235 | None | 231 | None |
| 236 | } | 232 | } |
src/handlers/compositor.rsmodified+2 -1
| @@ -303,8 +303,9 @@ impl CompositorHandler for State { | |||
| 303 | // Test client: alacritty with CSD. | 303 | // Test client: alacritty with CSD. |
| 304 | if let Some(root) = self.niri.root_surface.get(surface) { | 304 | if let Some(root) = self.niri.root_surface.get(surface) { |
| 305 | if let Some((mapped, _)) = self.niri.layout.find_window_and_output(root) { | 305 | if let Some((mapped, _)) = self.niri.layout.find_window_and_output(root) { |
| 306 | + let window = mapped.window.clone(); | ||
| 306 | self.backend.with_primary_renderer(|renderer| { | 307 | self.backend.with_primary_renderer(|renderer| { |
| 307 | - mapped.store_unmap_snapshot_if_empty(renderer); | 308 | + self.niri.layout.store_unmap_snapshot(renderer, &window); |
| 308 | }); | 309 | }); |
| 309 | } | 310 | } |
| 310 | } | 311 | } |
src/handlers/xdg_shell.rsmodified+6 -7
| @@ -30,7 +30,6 @@ use smithay::{ | |||
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | use crate::layout::workspace::ColumnWidth; | 32 | use crate::layout::workspace::ColumnWidth; |
| 33 | -use crate::layout::LayoutElement as _; | ||
| 34 | use crate::niri::{PopupGrabState, State}; | 33 | use crate::niri::{PopupGrabState, State}; |
| 35 | use crate::window::{InitialConfigureState, ResolvedWindowRules, Unmapped, WindowRef}; | 34 | use crate::window::{InitialConfigureState, ResolvedWindowRules, Unmapped, WindowRef}; |
| 36 | 35 | ||
| @@ -389,7 +388,7 @@ impl XdgShellHandler for State { | |||
| 389 | let output = output.clone(); | 388 | let output = output.clone(); |
| 390 | 389 | ||
| 391 | self.backend.with_primary_renderer(|renderer| { | 390 | self.backend.with_primary_renderer(|renderer| { |
| 392 | - mapped.store_unmap_snapshot_if_empty(renderer); | 391 | + self.niri.layout.store_unmap_snapshot(renderer, &window); |
| 393 | }); | 392 | }); |
| 394 | self.backend.with_primary_renderer(|renderer| { | 393 | self.backend.with_primary_renderer(|renderer| { |
| 395 | self.niri | 394 | self.niri |
| @@ -881,22 +880,22 @@ pub fn add_mapped_toplevel_pre_commit_hook(toplevel: &ToplevelSurface) -> HookId | |||
| 881 | false | 880 | false |
| 882 | }; | 881 | }; |
| 883 | 882 | ||
| 883 | + let window = mapped.window.clone(); | ||
| 884 | if got_unmapped { | 884 | if got_unmapped { |
| 885 | state.backend.with_primary_renderer(|renderer| { | 885 | state.backend.with_primary_renderer(|renderer| { |
| 886 | - mapped.store_unmap_snapshot_if_empty(renderer); | 886 | + state.niri.layout.store_unmap_snapshot(renderer, &window); |
| 887 | }); | 887 | }); |
| 888 | } else { | 888 | } else { |
| 889 | - // The toplevel remains mapped; clear any stored unmap snapshot. | ||
| 890 | - let _ = mapped.take_unmap_snapshot(); | ||
| 891 | - | ||
| 892 | if animate { | 889 | if animate { |
| 893 | state.backend.with_primary_renderer(|renderer| { | 890 | state.backend.with_primary_renderer(|renderer| { |
| 894 | mapped.store_animation_snapshot(renderer); | 891 | mapped.store_animation_snapshot(renderer); |
| 895 | }); | 892 | }); |
| 896 | 893 | ||
| 897 | - let window = mapped.window.clone(); | ||
| 898 | state.niri.layout.prepare_for_resize_animation(&window); | 894 | state.niri.layout.prepare_for_resize_animation(&window); |
| 899 | } | 895 | } |
| 896 | + | ||
| 897 | + // The toplevel remains mapped; clear any stored unmap snapshot. | ||
| 898 | + state.niri.layout.clear_unmap_snapshot(&window); | ||
| 900 | } | 899 | } |
| 901 | }) | 900 | }) |
| 902 | } | 901 | } |
src/layout/mod.rsmodified+48 -6
| @@ -140,8 +140,6 @@ pub trait LayoutElement { | |||
| 140 | /// Runs periodic clean-up tasks. | 140 | /// Runs periodic clean-up tasks. |
| 141 | fn refresh(&self); | 141 | fn refresh(&self); |
| 142 | 142 | ||
| 143 | - fn take_unmap_snapshot(&self) -> Option<LayoutElementRenderSnapshot>; | ||
| 144 | - | ||
| 145 | fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot>; | 143 | fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot>; |
| 146 | fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot>; | 144 | fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot>; |
| 147 | } | 145 | } |
| @@ -1749,6 +1747,54 @@ impl<W: LayoutElement> Layout<W> { | |||
| 1749 | } | 1747 | } |
| 1750 | } | 1748 | } |
| 1751 | 1749 | ||
| 1750 | + pub fn store_unmap_snapshot(&mut self, renderer: &mut GlesRenderer, window: &W::Id) { | ||
| 1751 | + let _span = tracy_client::span!("Layout::store_unmap_snapshot"); | ||
| 1752 | + | ||
| 1753 | + match &mut self.monitor_set { | ||
| 1754 | + MonitorSet::Normal { monitors, .. } => { | ||
| 1755 | + for mon in monitors { | ||
| 1756 | + for ws in &mut mon.workspaces { | ||
| 1757 | + if ws.has_window(window) { | ||
| 1758 | + ws.store_unmap_snapshot_if_empty(renderer, window); | ||
| 1759 | + return; | ||
| 1760 | + } | ||
| 1761 | + } | ||
| 1762 | + } | ||
| 1763 | + } | ||
| 1764 | + MonitorSet::NoOutputs { workspaces, .. } => { | ||
| 1765 | + for ws in workspaces { | ||
| 1766 | + if ws.has_window(window) { | ||
| 1767 | + ws.store_unmap_snapshot_if_empty(renderer, window); | ||
| 1768 | + return; | ||
| 1769 | + } | ||
| 1770 | + } | ||
| 1771 | + } | ||
| 1772 | + } | ||
| 1773 | + } | ||
| 1774 | + | ||
| 1775 | + pub fn clear_unmap_snapshot(&mut self, window: &W::Id) { | ||
| 1776 | + match &mut self.monitor_set { | ||
| 1777 | + MonitorSet::Normal { monitors, .. } => { | ||
| 1778 | + for mon in monitors { | ||
| 1779 | + for ws in &mut mon.workspaces { | ||
| 1780 | + if ws.has_window(window) { | ||
| 1781 | + ws.clear_unmap_snapshot(window); | ||
| 1782 | + return; | ||
| 1783 | + } | ||
| 1784 | + } | ||
| 1785 | + } | ||
| 1786 | + } | ||
| 1787 | + MonitorSet::NoOutputs { workspaces, .. } => { | ||
| 1788 | + for ws in workspaces { | ||
| 1789 | + if ws.has_window(window) { | ||
| 1790 | + ws.clear_unmap_snapshot(window); | ||
| 1791 | + return; | ||
| 1792 | + } | ||
| 1793 | + } | ||
| 1794 | + } | ||
| 1795 | + } | ||
| 1796 | + } | ||
| 1797 | + | ||
| 1752 | pub fn start_close_animation_for_window( | 1798 | pub fn start_close_animation_for_window( |
| 1753 | &mut self, | 1799 | &mut self, |
| 1754 | renderer: &mut GlesRenderer, | 1800 | renderer: &mut GlesRenderer, |
| @@ -1996,10 +2042,6 @@ mod tests { | |||
| 1996 | &EMPTY | 2042 | &EMPTY |
| 1997 | } | 2043 | } |
| 1998 | 2044 | ||
| 1999 | - fn take_unmap_snapshot(&self) -> Option<LayoutElementRenderSnapshot> { | ||
| 2000 | - None | ||
| 2001 | - } | ||
| 2002 | - | ||
| 2003 | fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> { | 2045 | fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> { |
| 2004 | None | 2046 | None |
| 2005 | } | 2047 | } |
src/layout/tile.rsmodified+46 -76
| @@ -1,3 +1,4 @@ | |||
| 1 | +use std::cell::RefCell; | ||
| 1 | use std::cmp::max; | 2 | use std::cmp::max; |
| 2 | use std::rc::Rc; | 3 | use std::rc::Rc; |
| 3 | use std::time::Duration; | 4 | use std::time::Duration; |
| @@ -17,11 +18,10 @@ use super::{ | |||
| 17 | use crate::animation::Animation; | 18 | use crate::animation::Animation; |
| 18 | use crate::niri_render_elements; | 19 | use crate::niri_render_elements; |
| 19 | use crate::render_helpers::offscreen::OffscreenRenderElement; | 20 | use crate::render_helpers::offscreen::OffscreenRenderElement; |
| 20 | -use crate::render_helpers::primary_gpu_texture::PrimaryGpuTextureRenderElement; | ||
| 21 | use crate::render_helpers::renderer::NiriRenderer; | 21 | use crate::render_helpers::renderer::NiriRenderer; |
| 22 | use crate::render_helpers::resize::ResizeRenderElement; | 22 | use crate::render_helpers::resize::ResizeRenderElement; |
| 23 | use crate::render_helpers::snapshot::RenderSnapshot; | 23 | use crate::render_helpers::snapshot::RenderSnapshot; |
| 24 | -use crate::render_helpers::{render_to_encompassing_texture, RenderTarget, ToRenderElement}; | 24 | +use crate::render_helpers::{render_to_encompassing_texture, RenderTarget}; |
| 25 | 25 | ||
| 26 | /// Toplevel window with decorations. | 26 | /// Toplevel window with decorations. |
| 27 | #[derive(Debug)] | 27 | #[derive(Debug)] |
| @@ -62,6 +62,9 @@ pub struct Tile<W: LayoutElement> { | |||
| 62 | /// The animation of a tile visually moving vertically. | 62 | /// The animation of a tile visually moving vertically. |
| 63 | move_y_animation: Option<MoveAnimation>, | 63 | move_y_animation: Option<MoveAnimation>, |
| 64 | 64 | ||
| 65 | + /// Snapshot of the last render for use in the close animation. | ||
| 66 | + unmap_snapshot: RefCell<Option<TileRenderSnapshot>>, | ||
| 67 | + | ||
| 65 | /// Configurable properties of the layout. | 68 | /// Configurable properties of the layout. |
| 66 | pub options: Rc<Options>, | 69 | pub options: Rc<Options>, |
| 67 | } | 70 | } |
| @@ -76,20 +79,8 @@ niri_render_elements! { | |||
| 76 | } | 79 | } |
| 77 | } | 80 | } |
| 78 | 81 | ||
| 79 | -niri_render_elements! { | 82 | +type TileRenderSnapshot = |
| 80 | - TileSnapshotContentsRenderElement => { | 83 | + RenderSnapshot<TileRenderElement<GlesRenderer>, TileRenderElement<GlesRenderer>>; |
| 81 | - Texture = PrimaryGpuTextureRenderElement, | ||
| 82 | - SolidColor = SolidColorRenderElement, | ||
| 83 | - } | ||
| 84 | -} | ||
| 85 | - | ||
| 86 | -niri_render_elements! { | ||
| 87 | - TileSnapshotRenderElement => { | ||
| 88 | - Contents = RescaleRenderElement<TileSnapshotContentsRenderElement>, | ||
| 89 | - FocusRing = FocusRingRenderElement, | ||
| 90 | - SolidColor = SolidColorRenderElement, | ||
| 91 | - } | ||
| 92 | -} | ||
| 93 | 84 | ||
| 94 | #[derive(Debug)] | 85 | #[derive(Debug)] |
| 95 | struct ResizeAnimation { | 86 | struct ResizeAnimation { |
| @@ -121,6 +112,7 @@ impl<W: LayoutElement> Tile<W> { | |||
| 121 | resize_animation: None, | 112 | resize_animation: None, |
| 122 | move_x_animation: None, | 113 | move_x_animation: None, |
| 123 | move_y_animation: None, | 114 | move_y_animation: None, |
| 115 | + unmap_snapshot: RefCell::new(None), | ||
| 124 | options, | 116 | options, |
| 125 | } | 117 | } |
| 126 | } | 118 | } |
| @@ -696,80 +688,58 @@ impl<W: LayoutElement> Tile<W> { | |||
| 696 | } | 688 | } |
| 697 | } | 689 | } |
| 698 | 690 | ||
| 699 | - fn render_snapshot<E, C>( | 691 | + pub fn store_unmap_snapshot_if_empty( |
| 700 | &self, | 692 | &self, |
| 701 | renderer: &mut GlesRenderer, | 693 | renderer: &mut GlesRenderer, |
| 702 | scale: Scale<f64>, | 694 | scale: Scale<f64>, |
| 703 | view_size: Size<i32, Logical>, | 695 | view_size: Size<i32, Logical>, |
| 704 | - contents: Vec<C>, | 696 | + ) { |
| 705 | - ) -> Vec<TileSnapshotRenderElement> | 697 | + let mut snapshot = self.unmap_snapshot.borrow_mut(); |
| 706 | - where | 698 | + if snapshot.is_some() { |
| 707 | - E: Into<TileSnapshotContentsRenderElement>, | 699 | + return; |
| 708 | - C: ToRenderElement<RenderElement = E>, | ||
| 709 | - { | ||
| 710 | - let alpha = if self.is_fullscreen { | ||
| 711 | - 1. | ||
| 712 | - } else { | ||
| 713 | - self.window.rules().opacity.unwrap_or(1.).clamp(0., 1.) | ||
| 714 | - }; | ||
| 715 | - | ||
| 716 | - let window_size = self.window_size(); | ||
| 717 | - let animated_window_size = self.animated_window_size(); | ||
| 718 | - let animated_scale = animated_window_size.to_f64() / window_size.to_f64(); | ||
| 719 | - | ||
| 720 | - let mut rv = vec![]; | ||
| 721 | - | ||
| 722 | - for baked in contents { | ||
| 723 | - let elem = baked.to_render_element(self.window_loc(), scale, alpha, Kind::Unspecified); | ||
| 724 | - let elem: TileSnapshotContentsRenderElement = elem.into(); | ||
| 725 | - | ||
| 726 | - let origin = self.window_loc().to_physical_precise_round(scale); | ||
| 727 | - let elem = RescaleRenderElement::from_element(elem, origin, animated_scale); | ||
| 728 | - rv.push(elem.into()); | ||
| 729 | - } | ||
| 730 | - | ||
| 731 | - if let Some(width) = self.effective_border_width() { | ||
| 732 | - rv.extend( | ||
| 733 | - self.border | ||
| 734 | - .render(renderer, Point::from((width, width)), scale, view_size) | ||
| 735 | - .map(Into::into), | ||
| 736 | - ); | ||
| 737 | - } | ||
| 738 | - | ||
| 739 | - if self.is_fullscreen { | ||
| 740 | - let elem = SolidColorRenderElement::from_buffer( | ||
| 741 | - &self.fullscreen_backdrop, | ||
| 742 | - Point::from((0, 0)), | ||
| 743 | - scale, | ||
| 744 | - 1., | ||
| 745 | - Kind::Unspecified, | ||
| 746 | - ); | ||
| 747 | - rv.push(elem.into()); | ||
| 748 | } | 700 | } |
| 749 | 701 | ||
| 750 | - rv | 702 | + *snapshot = Some(self.render_snapshot(renderer, scale, view_size)); |
| 751 | } | 703 | } |
| 752 | 704 | ||
| 753 | - pub fn take_snapshot_for_close_anim( | 705 | + fn render_snapshot( |
| 754 | &self, | 706 | &self, |
| 755 | renderer: &mut GlesRenderer, | 707 | renderer: &mut GlesRenderer, |
| 756 | scale: Scale<f64>, | 708 | scale: Scale<f64>, |
| 757 | view_size: Size<i32, Logical>, | 709 | view_size: Size<i32, Logical>, |
| 758 | - ) -> Option<RenderSnapshot<TileSnapshotRenderElement, TileSnapshotRenderElement>> { | 710 | + ) -> TileRenderSnapshot { |
| 759 | - let snapshot = self.window.take_unmap_snapshot()?; | 711 | + let _span = tracy_client::span!("Tile::render_snapshot"); |
| 760 | - | 712 | + |
| 761 | - Some(RenderSnapshot { | 713 | + let contents = self.render_inner( |
| 762 | - contents: self.render_snapshot(renderer, scale, view_size, snapshot.contents), | 714 | + renderer, |
| 763 | - blocked_out_contents: self.render_snapshot( | 715 | + Point::from((0, 0)), |
| 764 | - renderer, | 716 | + scale, |
| 765 | - scale, | 717 | + view_size, |
| 766 | - view_size, | 718 | + false, |
| 767 | - snapshot.blocked_out_contents, | 719 | + RenderTarget::Output, |
| 768 | - ), | 720 | + ); |
| 769 | - block_out_from: snapshot.block_out_from, | 721 | + |
| 722 | + // A bit of a hack to render blocked out as for screencast, but I think it's fine here. | ||
| 723 | + let blocked_out_contents = self.render_inner( | ||
| 724 | + renderer, | ||
| 725 | + Point::from((0, 0)), | ||
| 726 | + scale, | ||
| 727 | + view_size, | ||
| 728 | + false, | ||
| 729 | + RenderTarget::Screencast, | ||
| 730 | + ); | ||
| 731 | + | ||
| 732 | + RenderSnapshot { | ||
| 733 | + contents: contents.collect(), | ||
| 734 | + blocked_out_contents: blocked_out_contents.collect(), | ||
| 735 | + block_out_from: self.window.rules().block_out_from, | ||
| 770 | size: self.animated_tile_size(), | 736 | size: self.animated_tile_size(), |
| 771 | texture: Default::default(), | 737 | texture: Default::default(), |
| 772 | blocked_out_texture: Default::default(), | 738 | blocked_out_texture: Default::default(), |
| 773 | - }) | 739 | + } |
| 740 | + } | ||
| 741 | + | ||
| 742 | + pub fn take_unmap_snapshot(&self) -> Option<TileRenderSnapshot> { | ||
| 743 | + self.unmap_snapshot.take() | ||
| 774 | } | 744 | } |
| 775 | } | 745 | } |
src/layout/workspace.rsmodified+27 -3
| @@ -1176,6 +1176,32 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 1176 | self.activate_column(column_idx); | 1176 | self.activate_column(column_idx); |
| 1177 | } | 1177 | } |
| 1178 | 1178 | ||
| 1179 | + pub fn store_unmap_snapshot_if_empty(&mut self, renderer: &mut GlesRenderer, window: &W::Id) { | ||
| 1180 | + let (tile, _) = self | ||
| 1181 | + .tiles_in_render_order() | ||
| 1182 | + .find(|(tile, _)| tile.window().id() == window) | ||
| 1183 | + .unwrap(); | ||
| 1184 | + | ||
| 1185 | + // FIXME: workspaces should probably cache their last used scale so they can be correctly | ||
| 1186 | + // rendered even with no outputs connected. | ||
| 1187 | + let output_scale = self | ||
| 1188 | + .output | ||
| 1189 | + .as_ref() | ||
| 1190 | + .map(|o| Scale::from(o.current_scale().fractional_scale())) | ||
| 1191 | + .unwrap_or(Scale::from(1.)); | ||
| 1192 | + | ||
| 1193 | + tile.store_unmap_snapshot_if_empty(renderer, output_scale, self.view_size); | ||
| 1194 | + } | ||
| 1195 | + | ||
| 1196 | + pub fn clear_unmap_snapshot(&mut self, window: &W::Id) { | ||
| 1197 | + let (tile, _) = self | ||
| 1198 | + .tiles_in_render_order() | ||
| 1199 | + .find(|(tile, _)| tile.window().id() == window) | ||
| 1200 | + .unwrap(); | ||
| 1201 | + | ||
| 1202 | + let _ = tile.take_unmap_snapshot(); | ||
| 1203 | + } | ||
| 1204 | + | ||
| 1179 | pub fn start_close_animation_for_window( | 1205 | pub fn start_close_animation_for_window( |
| 1180 | &mut self, | 1206 | &mut self, |
| 1181 | renderer: &mut GlesRenderer, | 1207 | renderer: &mut GlesRenderer, |
| @@ -1194,9 +1220,7 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 1194 | .map(|o| Scale::from(o.current_scale().fractional_scale())) | 1220 | .map(|o| Scale::from(o.current_scale().fractional_scale())) |
| 1195 | .unwrap_or(Scale::from(1.)); | 1221 | .unwrap_or(Scale::from(1.)); |
| 1196 | 1222 | ||
| 1197 | - let Some(snapshot) = | 1223 | + let Some(snapshot) = tile.take_unmap_snapshot() else { |
| 1198 | - tile.take_snapshot_for_close_anim(renderer, output_scale, self.view_size) | ||
| 1199 | - else { | ||
| 1200 | return; | 1224 | return; |
| 1201 | }; | 1225 | }; |
| 1202 | 1226 | ||
src/window/mapped.rsmodified+0 -17
| @@ -47,9 +47,6 @@ pub struct Mapped { | |||
| 47 | /// Buffer to draw instead of the window when it should be blocked out. | 47 | /// Buffer to draw instead of the window when it should be blocked out. |
| 48 | block_out_buffer: RefCell<SolidColorBuffer>, | 48 | block_out_buffer: RefCell<SolidColorBuffer>, |
| 49 | 49 | ||
| 50 | - /// Snapshot of the last render for use in the close animation. | ||
| 51 | - unmap_snapshot: RefCell<Option<LayoutElementRenderSnapshot>>, | ||
| 52 | - | ||
| 53 | /// Whether the next configure should be animated, if the configured state changed. | 50 | /// Whether the next configure should be animated, if the configured state changed. |
| 54 | animate_next_configure: bool, | 51 | animate_next_configure: bool, |
| 55 | 52 | ||
| @@ -69,7 +66,6 @@ impl Mapped { | |||
| 69 | need_to_recompute_rules: false, | 66 | need_to_recompute_rules: false, |
| 70 | is_focused: false, | 67 | is_focused: false, |
| 71 | block_out_buffer: RefCell::new(SolidColorBuffer::new((0, 0), [0., 0., 0., 1.])), | 68 | block_out_buffer: RefCell::new(SolidColorBuffer::new((0, 0), [0., 0., 0., 1.])), |
| 72 | - unmap_snapshot: RefCell::new(None), | ||
| 73 | animate_next_configure: false, | 69 | animate_next_configure: false, |
| 74 | animate_serials: Vec::new(), | 70 | animate_serials: Vec::new(), |
| 75 | animation_snapshot: None, | 71 | animation_snapshot: None, |
| @@ -156,15 +152,6 @@ impl Mapped { | |||
| 156 | } | 152 | } |
| 157 | } | 153 | } |
| 158 | 154 | ||
| 159 | - pub fn store_unmap_snapshot_if_empty(&self, renderer: &mut GlesRenderer) { | ||
| 160 | - let mut snapshot = self.unmap_snapshot.borrow_mut(); | ||
| 161 | - if snapshot.is_some() { | ||
| 162 | - return; | ||
| 163 | - } | ||
| 164 | - | ||
| 165 | - *snapshot = Some(self.render_snapshot(renderer)); | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | pub fn should_animate_commit(&mut self, commit_serial: Serial) -> bool { | 155 | pub fn should_animate_commit(&mut self, commit_serial: Serial) -> bool { |
| 169 | let mut should_animate = false; | 156 | let mut should_animate = false; |
| 170 | self.animate_serials.retain_mut(|serial| { | 157 | self.animate_serials.retain_mut(|serial| { |
| @@ -380,10 +367,6 @@ impl LayoutElement for Mapped { | |||
| 380 | &self.rules | 367 | &self.rules |
| 381 | } | 368 | } |
| 382 | 369 | ||
| 383 | - fn take_unmap_snapshot(&self) -> Option<LayoutElementRenderSnapshot> { | ||
| 384 | - self.unmap_snapshot.take() | ||
| 385 | - } | ||
| 386 | - | ||
| 387 | fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> { | 370 | fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> { |
| 388 | self.animation_snapshot.as_ref() | 371 | self.animation_snapshot.as_ref() |
| 389 | } | 372 | } |