From 9fe65ed729c75a8401765cf373345aaba93352ca Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 5 Nov 2021 15:38:27 +0700 Subject: Rename `Renderer::present` to `with_primitives` --- examples/integration_opengl/src/main.rs | 2 +- examples/integration_wgpu/src/main.rs | 2 +- glow/src/window/compositor.rs | 2 +- graphics/src/renderer.rs | 4 +++- wgpu/src/window/compositor.rs | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/integration_opengl/src/main.rs b/examples/integration_opengl/src/main.rs index f0ff2076..3b63f22e 100644 --- a/examples/integration_opengl/src/main.rs +++ b/examples/integration_opengl/src/main.rs @@ -159,7 +159,7 @@ pub fn main() { } // And then iced on top - renderer.present(|backend, primitive| { + renderer.with_primitives(|backend, primitive| { backend.present( &gl, primitive, diff --git a/examples/integration_wgpu/src/main.rs b/examples/integration_wgpu/src/main.rs index d1000748..35a69a7d 100644 --- a/examples/integration_wgpu/src/main.rs +++ b/examples/integration_wgpu/src/main.rs @@ -195,7 +195,7 @@ pub fn main() { } // And then iced on top - renderer.present(|backend, primitive| { + renderer.with_primitives(|backend, primitive| { backend.present( &mut device, &mut staging_belt, diff --git a/glow/src/window/compositor.rs b/glow/src/window/compositor.rs index 36e591cd..a85a4560 100644 --- a/glow/src/window/compositor.rs +++ b/glow/src/window/compositor.rs @@ -74,7 +74,7 @@ impl iced_graphics::window::GLCompositor for Compositor { gl.clear(glow::COLOR_BUFFER_BIT); } - renderer.present(|backend, primitive| { + renderer.with_primitives(|backend, primitive| { backend.present(gl, primitive, viewport, overlay); }); } diff --git a/graphics/src/renderer.rs b/graphics/src/renderer.rs index 30f9d40e..69ed8775 100644 --- a/graphics/src/renderer.rs +++ b/graphics/src/renderer.rs @@ -31,7 +31,9 @@ impl Renderer { self.primitives.push(primitive); } - pub fn present(&mut self, f: impl FnOnce(&mut B, &[Primitive])) { + /// Runs the given closure with the [`Backend`] and the recorded primitives + /// of the [`Renderer`]. + pub fn with_primitives(&mut self, f: impl FnOnce(&mut B, &[Primitive])) { f(&mut self.backend, &self.primitives); } } diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs index 7bdd4c23..3b264475 100644 --- a/wgpu/src/window/compositor.rs +++ b/wgpu/src/window/compositor.rs @@ -179,13 +179,13 @@ impl iced_graphics::window::Compositor for Compositor { depth_stencil_attachment: None, }); - renderer.present(|backend, primitive| { + renderer.with_primitives(|backend, primitives| { backend.present( &mut self.device, &mut self.staging_belt, &mut encoder, view, - primitive, + primitives, viewport, overlay, ); -- cgit