Reformat using cargofmt

This commit is contained in:
timvisee
2018-09-22 18:30:29 +02:00
parent c37da9b40b
commit bd6b48cd3b
10 changed files with 146 additions and 223 deletions

View File

@@ -7,8 +7,6 @@ use image::DynamicImage;
use rect::Rect;
/// A handle to a painter thread.
///
/// This also holds a channel to the painter thread,
@@ -33,16 +31,12 @@ impl Handle {
/// Push an image update.
pub fn update_image(&self, full_image: &mut DynamicImage) {
// Crop the image to the area
let image = full_image.crop(
self.area.x,
self.area.y,
self.area.w,
self.area.h,
);
let image = full_image.crop(self.area.x, self.area.y, self.area.w, self.area.h);
// Push a new image to the thread
// TODO: return this result
self.image_sender.send(image)
self.image_sender
.send(image)
.expect("Failed to send image update to painter");
}
}

View File

@@ -1,3 +1,3 @@
// Reexport modules
pub mod painter;
pub mod handle;
pub mod painter;

View File

@@ -7,8 +7,6 @@ use color::Color;
use pix::client::Client;
use rect::Rect;
/// A painter that paints on a pixelflut panel.
pub struct Painter {
client: Client,
@@ -19,7 +17,12 @@ pub struct Painter {
impl Painter {
/// Create a new painter.
pub fn new(client: Client, area: Rect, offset: (u32, u32), image: Option<DynamicImage>) -> Painter {
pub fn new(
client: Client,
area: Rect,
offset: (u32, u32),
image: Option<DynamicImage>,
) -> Painter {
Painter {
client,
area,
@@ -61,15 +64,11 @@ impl Painter {
// Get the pixel at this location
let pixel = image.get_pixel(x, y);
// Get the channels
let channels = pixel.channels();
// Get the channels
let channels = pixel.channels();
// Define the color
let color = Color::from(
channels[0],
channels[1],
channels[2],
);
// Define the color
let color = Color::from(channels[0], channels[1], channels[2]);
// Set the pixel
self.client.write_pixel(