summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-11-08 04:59:34 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-11-08 04:59:34 +0100
commit676d8efe03ebdbeeb95aef96b8097395b788b1ab (patch)
treed552fce66b5be56fbd49544c8dfb8fca6e9dd46d
parent15f21641b7a27bbfb99f9f9f5d21b84445173900 (diff)
downloadiced-676d8efe03ebdbeeb95aef96b8097395b788b1ab.tar.gz
iced-676d8efe03ebdbeeb95aef96b8097395b788b1ab.tar.bz2
iced-676d8efe03ebdbeeb95aef96b8097395b788b1ab.zip
Rename `QuadBorderRadius` to `BorderRadius`
-rw-r--r--graphics/src/renderer.rs2
-rw-r--r--native/src/renderer.rs25
2 files changed, 13 insertions, 14 deletions
diff --git a/graphics/src/renderer.rs b/graphics/src/renderer.rs
index 46d37cd6..ff0dad2b 100644
--- a/graphics/src/renderer.rs
+++ b/graphics/src/renderer.rs
@@ -109,7 +109,7 @@ where
self.primitives.push(Primitive::Quad {
bounds: quad.bounds,
background: background.into(),
- border_radius: quad.border_radius.to_array(),
+ border_radius: quad.border_radius.into(),
border_width: quad.border_width,
border_color: quad.border_color,
});
diff --git a/native/src/renderer.rs b/native/src/renderer.rs
index 39c1b4c7..5e776be6 100644
--- a/native/src/renderer.rs
+++ b/native/src/renderer.rs
@@ -50,7 +50,7 @@ pub struct Quad {
pub bounds: Rectangle,
/// The border radius of the [`Quad`].
- pub border_radius: QuadBorderRadius,
+ pub border_radius: BorderRadius,
/// The border width of the [`Quad`].
pub border_width: f32,
@@ -59,30 +59,29 @@ pub struct Quad {
pub border_color: Color,
}
-/// The border radi for the corners of a [`Quad`] in the order:
+/// The border radi for the corners of a graphics primitive in the order:
/// top-left, top-right, bottom-right, bottom-left.
-#[derive(Debug, Clone, Copy, PartialEq)]
-pub struct QuadBorderRadius([f32; 4]);
-
-impl QuadBorderRadius {
- /// Convert the corners of the Quad into an array [top_left, top_right, bottom_left, bottom_right].
- pub fn to_array(self) -> [f32; 4] {
- self.0
- }
-}
+#[derive(Debug, Clone, Copy, PartialEq, Default)]
+pub struct BorderRadius([f32; 4]);
-impl From<f32> for QuadBorderRadius {
+impl From<f32> for BorderRadius {
fn from(w: f32) -> Self {
Self([w; 4])
}
}
-impl From<[f32; 4]> for QuadBorderRadius {
+impl From<[f32; 4]> for BorderRadius {
fn from(radi: [f32; 4]) -> Self {
Self(radi)
}
}
+impl From<BorderRadius> for [f32; 4] {
+ fn from(radi: BorderRadius) -> Self {
+ radi.0
+ }
+}
+
/// The styling attributes of a [`Renderer`].
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Style {