summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-11 15:37:56 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-11 15:37:56 +0200
commitde638f44a5c62459008a5c024b39c2443b72bf25 (patch)
tree68792277ddcebcf39dab8006926b017daf704510
parent8622e998f2701e7f4ca8d2f71c85150f436a9945 (diff)
downloadiced-de638f44a5c62459008a5c024b39c2443b72bf25.tar.gz
iced-de638f44a5c62459008a5c024b39c2443b72bf25.tar.bz2
iced-de638f44a5c62459008a5c024b39c2443b72bf25.zip
Write missing documentation in `iced_wgpu`
-rw-r--r--graphics/src/geometry.rs6
-rw-r--r--renderer/src/geometry.rs6
-rw-r--r--runtime/src/lib.rs2
-rw-r--r--tiny_skia/src/geometry.rs4
-rw-r--r--wgpu/src/geometry.rs15
-rw-r--r--wgpu/src/lib.rs2
6 files changed, 17 insertions, 18 deletions
diff --git a/graphics/src/geometry.rs b/graphics/src/geometry.rs
index 1f3d2c01..88997288 100644
--- a/graphics/src/geometry.rs
+++ b/graphics/src/geometry.rs
@@ -1,8 +1,4 @@
-//! Draw 2D graphics for your users.
-//!
-//! A [`Canvas`] widget can be used to draw different kinds of 2D shapes in a
-//! [`Frame`]. It can be used for animation, data visualization, game graphics,
-//! and more!
+//! Build and draw geometry.
pub mod fill;
pub mod path;
pub mod stroke;
diff --git a/renderer/src/geometry.rs b/renderer/src/geometry.rs
index a20e9d35..26e2fed0 100644
--- a/renderer/src/geometry.rs
+++ b/renderer/src/geometry.rs
@@ -135,15 +135,15 @@ impl Frame {
f(&mut frame);
- let translation = Vector::new(region.x, region.y);
+ let origin = Point::new(region.x, region.y);
match (self, frame) {
(Self::TinySkia(target), Self::TinySkia(frame)) => {
- target.clip(frame, translation);
+ target.clip(frame, origin);
}
#[cfg(feature = "wgpu")]
(Self::Wgpu(target), Self::Wgpu(frame)) => {
- target.clip(frame, translation);
+ target.clip(frame, origin);
}
#[allow(unreachable_patterns)]
_ => unreachable!(),
diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs
index 8a277e47..d3b84c7d 100644
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -33,7 +33,7 @@
)]
#![deny(
missing_debug_implementations,
- //missing_docs,
+ missing_docs,
unused_results,
clippy::extra_unused_lifetimes,
clippy::from_over_into,
diff --git a/tiny_skia/src/geometry.rs b/tiny_skia/src/geometry.rs
index a445b561..a1fd7b60 100644
--- a/tiny_skia/src/geometry.rs
+++ b/tiny_skia/src/geometry.rs
@@ -127,9 +127,9 @@ impl Frame {
self.transform = self.stack.pop().expect("Pop transform");
}
- pub fn clip(&mut self, frame: Self, translation: Vector) {
+ pub fn clip(&mut self, frame: Self, at: Point) {
self.primitives.push(Primitive::Translate {
- translation,
+ translation: Vector::new(at.x, at.y),
content: Box::new(frame.into_primitive()),
});
}
diff --git a/wgpu/src/geometry.rs b/wgpu/src/geometry.rs
index 8cfed1e5..7e17a7ad 100644
--- a/wgpu/src/geometry.rs
+++ b/wgpu/src/geometry.rs
@@ -1,3 +1,4 @@
+//! Build and draw geometry.
use crate::core::{Gradient, Point, Rectangle, Size, Vector};
use crate::graphics::geometry::fill::{self, Fill};
use crate::graphics::geometry::{
@@ -9,9 +10,7 @@ use lyon::geom::euclid;
use lyon::tessellation;
use std::borrow::Cow;
-/// The frame of a [`Canvas`].
-///
-/// [`Canvas`]: crate::widget::Canvas
+/// A frame for drawing some geometry.
#[allow(missing_debug_implementations)]
pub struct Frame {
size: Size,
@@ -353,10 +352,12 @@ impl Frame {
self.pop_transform();
}
+ /// Pushes the current transform in the transform stack.
pub fn push_transform(&mut self) {
self.transforms.previous.push(self.transforms.current);
}
+ /// Pops a transform from the transform stack and sets it as the current transform.
pub fn pop_transform(&mut self) {
self.transforms.current = self.transforms.previous.pop().unwrap();
}
@@ -373,14 +374,16 @@ impl Frame {
f(&mut frame);
- let translation = Vector::new(region.x, region.y);
+ let origin = Point::new(region.x, region.y);
- self.clip(frame, translation);
+ self.clip(frame, origin);
}
- pub fn clip(&mut self, frame: Frame, translation: Vector) {
+ /// Draws the clipped contents of the given [`Frame`] with origin at the given [`Point`].
+ pub fn clip(&mut self, frame: Frame, at: Point) {
let size = frame.size();
let primitives = frame.into_primitives();
+ let translation = Vector::new(at.x, at.y);
let (text, meshes) = primitives
.into_iter()
diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs
index 0b169140..4a92c345 100644
--- a/wgpu/src/lib.rs
+++ b/wgpu/src/lib.rs
@@ -25,7 +25,7 @@
)]
#![deny(
missing_debug_implementations,
- //missing_docs,
+ missing_docs,
unsafe_code,
unused_results,
clippy::extra_unused_lifetimes,