From f41eacc3dcc849f43c875872259ef8106e10be03 Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector0193@gmail.com>
Date: Mon, 23 Nov 2020 00:31:50 +0100
Subject: Use `f32` for `border_width` and `border_radius`

---
 graphics/src/layer.rs               |  4 ++--
 graphics/src/overlay/menu.rs        |  6 +++---
 graphics/src/primitive.rs           |  4 ++--
 graphics/src/renderer.rs            |  4 ++--
 graphics/src/widget/button.rs       |  4 ++--
 graphics/src/widget/container.rs    |  2 +-
 graphics/src/widget/progress_bar.rs |  4 ++--
 graphics/src/widget/radio.rs        |  6 +++---
 graphics/src/widget/rule.rs         |  4 ++--
 graphics/src/widget/scrollable.rs   |  2 +-
 graphics/src/widget/slider.rs       | 10 +++++-----
 graphics/src/widget/text_input.rs   |  8 ++++----
 12 files changed, 29 insertions(+), 29 deletions(-)

(limited to 'graphics/src')

diff --git a/graphics/src/layer.rs b/graphics/src/layer.rs
index 6aca738e..038c93ff 100644
--- a/graphics/src/layer.rs
+++ b/graphics/src/layer.rs
@@ -156,8 +156,8 @@ impl<'a> Layer<'a> {
                     color: match background {
                         Background::Color(color) => color.into_linear(),
                     },
-                    border_radius: *border_radius as f32,
-                    border_width: *border_width as f32,
+                    border_radius: *border_radius,
+                    border_width: *border_width,
                     border_color: border_color.into_linear(),
                 });
             }
diff --git a/graphics/src/overlay/menu.rs b/graphics/src/overlay/menu.rs
index f42c5e3c..ffe998c5 100644
--- a/graphics/src/overlay/menu.rs
+++ b/graphics/src/overlay/menu.rs
@@ -29,7 +29,7 @@ where
                         background: style.background,
                         border_color: style.border_color,
                         border_width: style.border_width,
-                        border_radius: 0,
+                        border_radius: 0.0,
                     },
                     primitives,
                 ],
@@ -80,8 +80,8 @@ where
                     bounds,
                     background: style.selected_background,
                     border_color: Color::TRANSPARENT,
-                    border_width: 0,
-                    border_radius: 0,
+                    border_width: 0.0,
+                    border_radius: 0.0,
                 });
             }
 
diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs
index 95dbf7dd..30263bd4 100644
--- a/graphics/src/primitive.rs
+++ b/graphics/src/primitive.rs
@@ -40,9 +40,9 @@ pub enum Primitive {
         /// The background of the quad
         background: Background,
         /// The border radius of the quad
-        border_radius: u16,
+        border_radius: f32,
         /// The border width of the quad
-        border_width: u16,
+        border_width: f32,
         /// The border color of the quad
         border_color: Color,
     },
diff --git a/graphics/src/renderer.rs b/graphics/src/renderer.rs
index a880e22a..ae5038db 100644
--- a/graphics/src/renderer.rs
+++ b/graphics/src/renderer.rs
@@ -119,8 +119,8 @@ fn explain_layout(
     primitives.push(Primitive::Quad {
         bounds: layout.bounds(),
         background: Background::Color(Color::TRANSPARENT),
-        border_radius: 0,
-        border_width: 1,
+        border_radius: 0.0,
+        border_width: 1.0,
         border_color: [0.6, 0.6, 0.6, 0.5].into(),
     });
 
diff --git a/graphics/src/widget/button.rs b/graphics/src/widget/button.rs
index a1afc940..87581175 100644
--- a/graphics/src/widget/button.rs
+++ b/graphics/src/widget/button.rs
@@ -66,7 +66,7 @@ where
         );
 
         (
-            if styling.background.is_some() || styling.border_width > 0 {
+            if styling.background.is_some() || styling.border_width > 0.0 {
                 let background = Primitive::Quad {
                     bounds,
                     background: styling
@@ -93,7 +93,7 @@ where
                             [0.0, 0.0, 0.0, 0.5].into(),
                         ),
                         border_radius: styling.border_radius,
-                        border_width: 0,
+                        border_width: 0.0,
                         border_color: Color::TRANSPARENT,
                     };
 
diff --git a/graphics/src/widget/container.rs b/graphics/src/widget/container.rs
index 4854f589..aae3e1d8 100644
--- a/graphics/src/widget/container.rs
+++ b/graphics/src/widget/container.rs
@@ -62,7 +62,7 @@ pub(crate) fn background(
     bounds: Rectangle,
     style: &container::Style,
 ) -> Option<Primitive> {
-    if style.background.is_some() || style.border_width > 0 {
+    if style.background.is_some() || style.border_width > 0.0 {
         Some(Primitive::Quad {
             bounds,
             background: style
diff --git a/graphics/src/widget/progress_bar.rs b/graphics/src/widget/progress_bar.rs
index 48acb3c1..c1801a41 100644
--- a/graphics/src/widget/progress_bar.rs
+++ b/graphics/src/widget/progress_bar.rs
@@ -43,7 +43,7 @@ where
                 bounds: Rectangle { ..bounds },
                 background: style.background,
                 border_radius: style.border_radius,
-                border_width: 0,
+                border_width: 0.0,
                 border_color: Color::TRANSPARENT,
             }],
         };
@@ -57,7 +57,7 @@ where
                     },
                     background: style.bar,
                     border_radius: style.border_radius,
-                    border_width: 0,
+                    border_width: 0.0,
                     border_color: Color::TRANSPARENT,
                 };
 
diff --git a/graphics/src/widget/radio.rs b/graphics/src/widget/radio.rs
index da41ac47..fd3d8145 100644
--- a/graphics/src/widget/radio.rs
+++ b/graphics/src/widget/radio.rs
@@ -42,7 +42,7 @@ where
         let radio = Primitive::Quad {
             bounds,
             background: style.background,
-            border_radius: (size / 2.0) as u16,
+            border_radius: size / 2.0,
             border_width: style.border_width,
             border_color: style.border_color,
         };
@@ -58,8 +58,8 @@ where
                             height: bounds.height - dot_size,
                         },
                         background: Background::Color(style.dot_color),
-                        border_radius: (dot_size / 2.0) as u16,
-                        border_width: 0,
+                        border_radius: dot_size / 2.0,
+                        border_width: 0.0,
                         border_color: Color::TRANSPARENT,
                     };
 
diff --git a/graphics/src/widget/rule.rs b/graphics/src/widget/rule.rs
index a7a5d0e7..835ebed8 100644
--- a/graphics/src/widget/rule.rs
+++ b/graphics/src/widget/rule.rs
@@ -43,7 +43,7 @@ where
                 },
                 background: Background::Color(style.color),
                 border_radius: style.radius,
-                border_width: 0,
+                border_width: 0.0,
                 border_color: Color::TRANSPARENT,
             }
         } else {
@@ -63,7 +63,7 @@ where
                 },
                 background: Background::Color(style.color),
                 border_radius: style.radius,
-                border_width: 0,
+                border_width: 0.0,
                 border_color: Color::TRANSPARENT,
             }
         };
diff --git a/graphics/src/widget/scrollable.rs b/graphics/src/widget/scrollable.rs
index fed79c18..57065ba2 100644
--- a/graphics/src/widget/scrollable.rs
+++ b/graphics/src/widget/scrollable.rs
@@ -103,7 +103,7 @@ where
                 };
 
                 let is_scrollbar_visible =
-                    style.background.is_some() || style.border_width > 0;
+                    style.background.is_some() || style.border_width > 0.0;
 
                 let scroller = if is_mouse_over
                     || state.is_scroller_grabbed()
diff --git a/graphics/src/widget/slider.rs b/graphics/src/widget/slider.rs
index 99f0a098..051e18b8 100644
--- a/graphics/src/widget/slider.rs
+++ b/graphics/src/widget/slider.rs
@@ -57,8 +57,8 @@ where
                     height: 2.0,
                 },
                 background: Background::Color(style.rail_colors.0),
-                border_radius: 0,
-                border_width: 0,
+                border_radius: 0.0,
+                border_width: 0.0,
                 border_color: Color::TRANSPARENT,
             },
             Primitive::Quad {
@@ -69,8 +69,8 @@ where
                     height: 2.0,
                 },
                 background: Background::Color(style.rail_colors.1),
-                border_radius: 0,
-                border_width: 0,
+                border_radius: 0.0,
+                border_width: 0.0,
                 border_color: Color::TRANSPARENT,
             },
         );
@@ -82,7 +82,7 @@ where
             .shape
         {
             HandleShape::Circle { radius } => {
-                (f32::from(radius * 2), f32::from(radius * 2), radius)
+                (radius * 2.0, radius * 2.0, radius)
             }
             HandleShape::Rectangle {
                 width,
diff --git a/graphics/src/widget/text_input.rs b/graphics/src/widget/text_input.rs
index 575d67f5..55eb34e4 100644
--- a/graphics/src/widget/text_input.rs
+++ b/graphics/src/widget/text_input.rs
@@ -149,8 +149,8 @@ where
                             background: Background::Color(
                                 style_sheet.value_color(),
                             ),
-                            border_radius: 0,
-                            border_width: 0,
+                            border_radius: 0.0,
+                            border_width: 0.0,
                             border_color: Color::TRANSPARENT,
                         },
                         offset,
@@ -193,8 +193,8 @@ where
                             background: Background::Color(
                                 style_sheet.selection_color(),
                             ),
-                            border_radius: 0,
-                            border_width: 0,
+                            border_radius: 0.0,
+                            border_width: 0.0,
                             border_color: Color::TRANSPARENT,
                         },
                         if end == right {
-- 
cgit