@@ 30,15 30,15 @@ pub fn draw_elem(
match fill {
Paint::Color(ref color) => match color {
color::Color::RGB(rgb) => gr.set_source_rgb(
- rgb.r as f64 / 255.0,
- rgb.g as f64 / 255.0,
- rgb.b as f64 / 255.0,
+ f64::from(rgb.r) / 255.0,
+ f64::from(rgb.g) / 255.0,
+ f64::from(rgb.b) / 255.0,
),
color::Color::RGBA(rgba) => gr.set_source_rgba(
- rgba.r as f64 / 255.0,
- rgba.g as f64 / 255.0,
- rgba.b as f64 / 255.0,
- rgba.a as f64,
+ f64::from(rgba.r) / 255.0,
+ f64::from(rgba.g) / 255.0,
+ f64::from(rgba.b) / 255.0,
+ f64::from(rgba.a),
),
},
}
@@ 76,15 76,15 @@ pub fn draw_elem(
match fill {
Paint::Color(ref color) => match color {
color::Color::RGB(rgb) => gr.set_source_rgb(
- rgb.r as f64 / 255.0,
- rgb.g as f64 / 255.0,
- rgb.b as f64 / 255.0,
+ f64::from(rgb.r) / 255.0,
+ f64::from(rgb.g) / 255.0,
+ f64::from(rgb.b) / 255.0,
),
color::Color::RGBA(rgba) => gr.set_source_rgba(
- rgba.r as f64 / 255.0,
- rgba.g as f64 / 255.0,
- rgba.b as f64 / 255.0,
- rgba.a as f64,
+ f64::from(rgba.r) / 255.0,
+ f64::from(rgba.g) / 255.0,
+ f64::from(rgba.b) / 255.0,
+ f64::from(rgba.a),
),
},
}
@@ 171,7 171,7 @@ fn main() {
if let Some(selection) = selection {
let bbox = selection.as_ref().get_aabb();
ctx.set_source_rgb(0.0, 0.0, 0.0);
- ctx.set_dash(&mut [5.0], 0.0);
+ ctx.set_dash(&[5.0], 0.0);
ctx.rectangle(
bbox.position.x,
bbox.position.y,
@@ 180,7 180,7 @@ fn main() {
);
ctx.stroke();
- ctx.set_dash(&mut [], 0.0);
+ ctx.set_dash(&[], 0.0);
let tool = instance.tool.read().unwrap();
let tool: &ToolMode = &tool;
@@ 161,9 161,9 @@ pub struct AABB {
impl AABB {
pub fn contains(&self, point: &Point2) -> bool {
- return point.x > self.position.x
+ point.x > self.position.x
&& point.y > self.position.y
&& point.x < self.position.x + self.size.width
- && point.y < self.position.y + self.size.height;
+ && point.y < self.position.y + self.size.height
}
}