this repo has no description
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

🔥 Remove useless Layer#flush

Since render cache removed, see 92249812724fca03b093af2df2cbaca53a2c2e45

+5 -22
-1
examples/schedule-hell/src/main.rs
··· 229 229 ); 230 230 231 231 canvas.put_layer_on_top("ch"); 232 - canvas.layer("ch").flush(); 233 232 Ok(()) 234 233 }) 235 234 .when_remaining(10, &|canvas, _| {
-14
src/graphics/layer.rs
··· 39 39 pub fn safe_object(&mut self, name: &str) -> Option<&mut ColoredObject> { 40 40 self.objects.get_mut(name) 41 41 } 42 - 43 - // Flush the render cache. 44 - pub fn flush(&mut self) { 45 - // nothing 46 - } 47 - 48 42 // Remove all objects. 49 43 pub fn clear(&mut self) { 50 44 self.objects.clear(); 51 - self.flush(); 52 45 } 53 46 54 47 pub fn replace(&mut self, with: Layer) { 55 48 self.objects.clone_from(&with.objects); 56 - self.flush(); 57 49 } 58 50 59 51 pub fn remove_all_objects_in(&mut self, region: &Region) { ··· 66 58 for obj in self.objects.values_mut() { 67 59 obj.fill = Some(fill); 68 60 } 69 - self.flush(); 70 61 } 71 62 72 63 pub fn filter_all_objects(&mut self, filter: Filter) { 73 64 for obj in self.objects.values_mut() { 74 65 obj.filters.push(filter) 75 66 } 76 - self.flush(); 77 67 } 78 68 79 69 pub fn move_all_objects(&mut self, dx: i32, dy: i32) { ··· 82 72 .for_each(|(_, ColoredObject { object, .. })| { 83 73 object.translate(dx, dy) 84 74 }); 85 - self.flush(); 86 75 } 87 76 88 77 pub fn add(&mut self, name: impl Display, object: impl Into<ColoredObject>) { ··· 103 92 let name_str = format!("{}", name); 104 93 105 94 self.objects.insert(name_str, object.into()); 106 - self.flush(); 107 95 } 108 96 109 97 pub fn filter_object( ··· 117 105 .filters 118 106 .push(filter); 119 107 120 - self.flush(); 121 108 Ok(()) 122 109 } 123 110 124 111 pub fn remove_object(&mut self, name: &str) { 125 112 self.objects.remove(name); 126 - self.flush(); 127 113 } 128 114 129 115 pub fn replace_object(&mut self, name: &str, object: ColoredObject) {
+1 -1
src/video/animation.rs
··· 6 6 pub type AnimationUpdateFunction = 7 7 dyn Fn(f32, &mut Canvas, usize) -> anyhow::Result<()> + Send + Sync; 8 8 9 - /// An animation that only manipulates a single layer. The layer's render cache is automatically flushed at the end. See `AnimationUpdateFunction` for more information. 9 + /// An animation that only manipulates a single layer. See `AnimationUpdateFunction` for more information. 10 10 pub type LayerAnimationUpdateFunction = 11 11 dyn Fn(f32, &mut Layer, usize) -> anyhow::Result<()> + Send + Sync; 12 12
-1
src/video/context.rs
··· 179 179 name: format!("unnamed animation {}", nanoid!()), 180 180 update: Box::new(move |progress, canvas, ms| { 181 181 (f)(progress, canvas.layer(layer), ms)?; 182 - canvas.layer(layer).flush(); 183 182 Ok(()) 184 183 }), 185 184 };
-1
src/video/hooks.rs
··· 433 433 render_function: Box::new(move |canvas, context| { 434 434 let amplitude = context.stem(stem).amplitude_relative(); 435 435 update(amplitude, canvas.layer(layer), context.ms)?; 436 - canvas.layer(layer).flush(); 437 436 Ok(()) 438 437 }), 439 438 })
+4 -4
src/vst/remote_probe.rs
··· 61 61 .as_millis() as usize 62 62 } 63 63 64 - /// Store a automation data point. Don't forget to call .out.flush(), this one does not flush on its own! 64 + /// Store a automation data point. 65 65 pub fn store_automation( 66 66 &mut self, 67 67 timestamp: usize, ··· 71 71 self.store(Datapoint::Automation(timestamp, param_id, param.value())) 72 72 } 73 73 74 - /// Store a audio data point. Don't forget to call .out.flush(), this one does not flush on its own! 74 + /// Store a audio data point. 75 75 pub fn store_audio( 76 76 &mut self, 77 77 timestamp: usize, ··· 80 80 self.store(Datapoint::Audio(timestamp, samples)) 81 81 } 82 82 83 - /// Store a midi data point. Don't forget to call .out.flush(), this one does not flush on its own! 83 + /// Store a midi data point. 84 84 pub fn store_midi(&mut self, timestamp: usize, data: &[u8]) -> Result<()> { 85 85 self.store(Datapoint::Midi(timestamp, data.to_vec())) 86 86 } 87 87 88 - /// Store a data point. Don't forget to call .out.flush(), this one does not flush on its own! 88 + /// Store a data point. 89 89 pub fn say(&mut self, msg: impl Display) -> Result<()> { 90 90 self.out 91 91 .write(format!("{} say {}", self.id, msg).into())