Skip to content

Commit

Permalink
Use the shorthand image::GrayAlphaImage instead of image::ImageBuffer…
Browse files Browse the repository at this point in the history
…<image::LumaA<u8>, Vec<u8>>
  • Loading branch information
not-avail committed Jun 24, 2018
1 parent 240d9d2 commit 3f70a5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
9 changes: 3 additions & 6 deletions src/framebuffer/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use framebuffer;
use framebuffer::common;

use image::{ImageBuffer, LumaA};
use image::{GrayAlphaImage, ImageBuffer};

impl<'a> framebuffer::FramebufferIO for framebuffer::core::Framebuffer<'a> {
fn write_frame(&mut self, frame: &[u8]) {
Expand Down Expand Up @@ -60,10 +60,7 @@ impl<'a> framebuffer::FramebufferIO for framebuffer::core::Framebuffer<'a> {
}
}

fn dump_region(
&self,
rect: common::mxcfb_rect,
) -> Result<ImageBuffer<LumaA<u8>, Vec<u8>>, &'static str> {
fn dump_region(&self, rect: common::mxcfb_rect) -> Result<GrayAlphaImage, &'static str> {
if rect.width == 0 || rect.height == 0 {
return Err("Unable to dump a region with zero height/width");
}
Expand Down Expand Up @@ -101,7 +98,7 @@ impl<'a> framebuffer::FramebufferIO for framebuffer::core::Framebuffer<'a> {
fn restore_region(
&mut self,
rect: common::mxcfb_rect,
data: &ImageBuffer<LumaA<u8>, Vec<u8>>,
data: &GrayAlphaImage,
) -> Result<u32, &'static str> {
if rect.width == 0 || rect.height == 0 {
return Err("Unable to restore a region with zero height/width");
Expand Down
7 changes: 2 additions & 5 deletions src/framebuffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ pub trait FramebufferIO {
/// Reads the value at offset `ofst` from the mmapp'ed framebuffer region
fn read_offset(&self, ofst: isize) -> u8;
/// Dumps the contents of the specified rectangle into an `image::ImageBuffer<image::LumaA<u8>, Vec<u8>>`
fn dump_region(
&self,
rect: common::mxcfb_rect,
) -> Result<image::ImageBuffer<image::LumaA<u8>, Vec<u8>>, &'static str>;
fn dump_region(&self, rect: common::mxcfb_rect) -> Result<image::GrayAlphaImage, &'static str>;
/// Restores into the framebuffer the contents of the specified rectangle from an `image::ImageBuffer<image::LumaA<u8>, Vec<u8>>`
fn restore_region(
&mut self,
rect: common::mxcfb_rect,
data: &image::ImageBuffer<image::LumaA<u8>, Vec<u8>>,
data: &image::GrayAlphaImage,
) -> Result<u32, &'static str>;
}

Expand Down

0 comments on commit 3f70a5b

Please sign in to comment.