diff --git a/src/main.rs b/src/main.rs index 0b619c7..bf7bf16 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,6 @@ mod arg_handler; mod color; mod image_manager; mod painter; -mod painter_handle; mod pix; mod rect; diff --git a/src/painter_handle.rs b/src/painter/handle.rs similarity index 90% rename from src/painter_handle.rs rename to src/painter/handle.rs index bf84511..ddfd6f9 100644 --- a/src/painter_handle.rs +++ b/src/painter/handle.rs @@ -13,17 +13,17 @@ use rect::Rect; /// /// This also holds a channel to the painter thread, /// to allow image updates to be pushed to the thread. -pub struct PainterHandle { +pub struct Handle { #[allow(dead_code)] thread: JoinHandle, area: Rect, image_sender: Sender, } -impl PainterHandle { +impl Handle { /// Create a new handle from the given properties. - pub fn new(thread: JoinHandle, area: Rect, image_sender: Sender) -> PainterHandle { - PainterHandle { + pub fn new(thread: JoinHandle, area: Rect, image_sender: Sender) -> Handle { + Handle { thread, area, image_sender, diff --git a/src/painter/mod.rs b/src/painter/mod.rs new file mode 100644 index 0000000..ad0c615 --- /dev/null +++ b/src/painter/mod.rs @@ -0,0 +1,3 @@ +// Re-export modules +pub mod painter; +pub mod handle; diff --git a/src/painter.rs b/src/painter/painter.rs similarity index 100% rename from src/painter.rs rename to src/painter/painter.rs diff --git a/src/pix/canvas.rs b/src/pix/canvas.rs index 8565523..9e7cf03 100644 --- a/src/pix/canvas.rs +++ b/src/pix/canvas.rs @@ -6,18 +6,18 @@ use std::thread; use image::DynamicImage; -use painter::Painter; -use painter_handle::PainterHandle; +use painter::painter::Painter; +use painter::handle::Handle; use pix::client::Client; use rect::Rect; -/// A pixflut instance +/// A pixflut instance pub struct Canvas { host: String, - painter_count: usize, - painter_handles: Vec, + painter_count: usize, + painter_handles: Vec, size: (u32, u32), offset: (u32, u32), } @@ -33,14 +33,14 @@ impl Canvas { // Initialize the object let mut canvas = Canvas { host: host.to_string(), - painter_count, + painter_count, painter_handles: Vec::with_capacity(painter_count), size, offset, }; - // Show a status message - println!("Starting painter threads..."); + // Show a status message + println!("Starting painter threads..."); // Spawn some painters canvas.spawn_painters(); @@ -53,19 +53,19 @@ impl Canvas { fn spawn_painters(&mut self) { // Spawn some painters for i in 0..self.painter_count { - // Determine the slice width - let width = self.size.0 / (self.painter_count as u32); + // Determine the slice width + let width = self.size.0 / (self.painter_count as u32); - // Define the area to paint per thread - let painter_area = Rect::from( - (i as u32) * width, - 0, - width, - self.size.1, - ); + // Define the area to paint per thread + let painter_area = Rect::from( + (i as u32) * width, + 0, + width, + self.size.1, + ); - // Spawn the painter - self.spawn_painter(painter_area); + // Spawn the painter + self.spawn_painter(painter_area); } } @@ -113,7 +113,7 @@ impl Canvas { // Create a new painter handle, pust it to the list self.painter_handles.push( - PainterHandle::new( + Handle::new( thread, area, tx, diff --git a/src/pix/mod.rs b/src/pix/mod.rs index 2f3a749..14a715f 100644 --- a/src/pix/mod.rs +++ b/src/pix/mod.rs @@ -1,2 +1,3 @@ +// Re-export modules pub mod canvas; pub mod client;