summaryrefslogtreecommitdiffstats
path: root/graphics/src/geometry/frame.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-04-14 13:43:10 +0200
committerLibravatar GitHub <noreply@github.com>2024-04-14 13:43:10 +0200
commit105b8bd5ad6ade1f203a0d8b0b93bd06f61f621a (patch)
tree4a5efa021b0dbe7d87ff57993c118753a32ea241 /graphics/src/geometry/frame.rs
parentee105e3bee1bc676dcf3324693984ccda8e4e733 (diff)
parentdbbbadfc950dfdfd02c7abbbf993e0685ca0f64a (diff)
downloadiced-105b8bd5ad6ade1f203a0d8b0b93bd06f61f621a.tar.gz
iced-105b8bd5ad6ade1f203a0d8b0b93bd06f61f621a.tar.bz2
iced-105b8bd5ad6ade1f203a0d8b0b93bd06f61f621a.zip
Merge pull request #2382 from iced-rs/wgpu/better-architecture
Improved architecture for `iced_wgpu` and `iced_tiny_skia`
Diffstat (limited to 'graphics/src/geometry/frame.rs')
-rw-r--r--graphics/src/geometry/frame.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/graphics/src/geometry/frame.rs b/graphics/src/geometry/frame.rs
index ad35e8ec..377589d7 100644
--- a/graphics/src/geometry/frame.rs
+++ b/graphics/src/geometry/frame.rs
@@ -113,13 +113,11 @@ where
region: Rectangle,
f: impl FnOnce(&mut Self) -> R,
) -> R {
- let mut frame = self.draft(region.size());
+ let mut frame = self.draft(region);
let result = f(&mut frame);
- let origin = Point::new(region.x, region.y);
-
- self.paste(frame, origin);
+ self.paste(frame, Point::new(region.x, region.y));
result
}
@@ -129,14 +127,14 @@ where
/// Draw its contents back to this [`Frame`] with [`paste`].
///
/// [`paste`]: Self::paste
- pub fn draft(&mut self, size: Size) -> Self {
+ fn draft(&mut self, clip_bounds: Rectangle) -> Self {
Self {
- raw: self.raw.draft(size),
+ raw: self.raw.draft(clip_bounds),
}
}
/// Draws the contents of the given [`Frame`] with origin at the given [`Point`].
- pub fn paste(&mut self, frame: Self, at: Point) {
+ fn paste(&mut self, frame: Self, at: Point) {
self.raw.paste(frame.raw, at);
}
@@ -187,7 +185,7 @@ pub trait Backend: Sized {
fn scale(&mut self, scale: impl Into<f32>);
fn scale_nonuniform(&mut self, scale: impl Into<Vector>);
- fn draft(&mut self, size: Size) -> Self;
+ fn draft(&mut self, clip_bounds: Rectangle) -> Self;
fn paste(&mut self, frame: Self, at: Point);
fn stroke<'a>(&mut self, path: &Path, stroke: impl Into<Stroke<'a>>);
@@ -232,7 +230,7 @@ impl Backend for () {
fn scale(&mut self, _scale: impl Into<f32>) {}
fn scale_nonuniform(&mut self, _scale: impl Into<Vector>) {}
- fn draft(&mut self, _size: Size) -> Self {}
+ fn draft(&mut self, _clip_bounds: Rectangle) -> Self {}
fn paste(&mut self, _frame: Self, _at: Point) {}
fn stroke<'a>(&mut self, _path: &Path, _stroke: impl Into<Stroke<'a>>) {}