Retired::append, to take over a closing owner's images
This commit is contained in:
1 file changed
+6
-1
@@ -5,7 +5,7 @@ use std::sync::Arc;
|
|||||||
use gpui::{RenderImage, Window};
|
use gpui::{RenderImage, Window};
|
||||||
|
|
||||||
/// Images to free; GPUI keeps each painted image until told.
|
/// Images to free; GPUI keeps each painted image until told.
|
||||||
#[derive(Default)]
|
#[derive(Default, Clone)]
|
||||||
pub struct Retired(Vec<Arc<RenderImage>>);
|
pub struct Retired(Vec<Arc<RenderImage>>);
|
||||||
|
|
||||||
impl Retired {
|
impl Retired {
|
||||||
@@ -14,6 +14,11 @@ impl Retired {
|
|||||||
self.0.push(image);
|
self.0.push(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Takes over another owner's waiting images.
|
||||||
|
pub fn append(&mut self, mut other: Retired) {
|
||||||
|
self.0.append(&mut other.0);
|
||||||
|
}
|
||||||
|
|
||||||
/// Frees images no one else holds; call while painting.
|
/// Frees images no one else holds; call while painting.
|
||||||
pub fn release(&mut self, window: &mut Window) {
|
pub fn release(&mut self, window: &mut Window) {
|
||||||
// A shared image may still be drawn; it waits.
|
// A shared image may still be drawn; it waits.
|
||||||
|
|||||||
Reference in new issue
Block a user