From b972ebca8f8c23d2df1b45bb26038789766a5a65 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 21 Mar 2024 23:30:36 +0100 Subject: Restore `canvas::Program` API --- examples/arc/src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'examples/arc') diff --git a/examples/arc/src/main.rs b/examples/arc/src/main.rs index a7893efa..0aba82a9 100644 --- a/examples/arc/src/main.rs +++ b/examples/arc/src/main.rs @@ -1,7 +1,9 @@ use std::{f32::consts::PI, time::Instant}; use iced::mouse; -use iced::widget::canvas::{self, stroke, Cache, Canvas, Frame, Path, Stroke}; +use iced::widget::canvas::{ + self, stroke, Cache, Canvas, Frame, Geometry, Path, Stroke, +}; use iced::{Element, Length, Point, Rectangle, Renderer, Subscription, Theme}; pub fn main() -> iced::Result { @@ -55,11 +57,11 @@ impl canvas::Program for Arc { fn draw( &self, _state: &Self::State, - renderer: &mut Renderer, + renderer: &Renderer, theme: &Theme, bounds: Rectangle, _cursor: mouse::Cursor, - ) { + ) -> Vec { let geometry = self.cache.draw(renderer, bounds.size(), |frame| { let palette = theme.palette(); @@ -102,6 +104,6 @@ impl canvas::Program for Arc { ); }); - renderer.draw_geometry([geometry]); + vec![geometry] } } -- cgit