Skip to content

Commit 1a30cd0

Browse files
committed
Implement geometry rendering for vello_cpu backend
1 parent 1cc9e18 commit 1a30cd0

4 files changed

Lines changed: 601 additions & 17 deletions

File tree

examples/clock/src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use iced::widget::canvas::{Cache, Geometry, LineCap, Path, Stroke, stroke};
55
use iced::widget::{canvas, container, text};
66
use iced::{
77
Degrees, Element, Fill, Font, Point, Radians, Rectangle, Renderer, Size, Subscription, Theme,
8-
Vector,
98
};
109

1110
pub fn main() -> iced::Result {
@@ -85,7 +84,6 @@ impl<Message> canvas::Program<Message> for Clock {
8584
frame.fill(&background, palette.secondary.strong.color);
8685

8786
let short_hand = Path::line(Point::ORIGIN, Point::new(0.0, -0.5 * radius));
88-
8987
let long_hand = Path::line(Point::ORIGIN, Point::new(0.0, -0.8 * radius));
9088

9189
let width = radius / 100.0;
@@ -108,7 +106,7 @@ impl<Message> canvas::Program<Message> for Clock {
108106
}
109107
};
110108

111-
frame.translate(Vector::new(center.x, center.y));
109+
frame.translate(center - Point::ORIGIN);
112110
let minutes_portion = Radians::from(hand_rotation(self.now.minute(), 60)) / 12.0;
113111
let hour_hand_angle =
114112
Radians::from(hand_rotation(self.now.hour(), 12)) + minutes_portion;

0 commit comments

Comments
 (0)