Move painter modules to sub module
This commit is contained in:
@@ -6,7 +6,6 @@ mod arg_handler;
|
||||
mod color;
|
||||
mod image_manager;
|
||||
mod painter;
|
||||
mod painter_handle;
|
||||
mod pix;
|
||||
mod rect;
|
||||
|
||||
|
||||
@@ -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<u32>,
|
||||
area: Rect,
|
||||
image_sender: Sender<DynamicImage>,
|
||||
}
|
||||
|
||||
impl PainterHandle {
|
||||
impl Handle {
|
||||
/// Create a new handle from the given properties.
|
||||
pub fn new(thread: JoinHandle<u32>, area: Rect, image_sender: Sender<DynamicImage>) -> PainterHandle {
|
||||
PainterHandle {
|
||||
pub fn new(thread: JoinHandle<u32>, area: Rect, image_sender: Sender<DynamicImage>) -> Handle {
|
||||
Handle {
|
||||
thread,
|
||||
area,
|
||||
image_sender,
|
||||
3
src/painter/mod.rs
Normal file
3
src/painter/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
// Re-export modules
|
||||
pub mod painter;
|
||||
pub mod handle;
|
||||
@@ -6,8 +6,8 @@ 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;
|
||||
|
||||
@@ -17,7 +17,7 @@ use rect::Rect;
|
||||
pub struct Canvas {
|
||||
host: String,
|
||||
painter_count: usize,
|
||||
painter_handles: Vec<PainterHandle>,
|
||||
painter_handles: Vec<Handle>,
|
||||
size: (u32, u32),
|
||||
offset: (u32, u32),
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
// Re-export modules
|
||||
pub mod canvas;
|
||||
pub mod client;
|
||||
|
||||
Reference in New Issue
Block a user