diff options
-rw-r--r-- | components/gfx/paint_context.rs | 10 | ||||
-rw-r--r-- | components/net/image/base.rs | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs index d106566aaef..2f277de6a84 100644 --- a/components/gfx/paint_context.rs +++ b/components/gfx/paint_context.rs @@ -23,7 +23,7 @@ use geom::side_offsets::SideOffsets2D; use geom::size::Size2D; use libc::size_t; use libc::types::common::c99::{uint16_t, uint32_t}; -use png::{RGB8, RGBA8, K8, KA8}; +use png::PixelsByColorType; use servo_net::image::base::Image; use servo_util::geometry::{Au, MAX_RECT}; use servo_util::opts; @@ -123,10 +123,10 @@ impl<'a> PaintContext<'a> { pub fn draw_image(&self, bounds: Rect<Au>, image: Arc<Box<Image>>) { let size = Size2D(image.width as i32, image.height as i32); let (pixel_width, pixels, source_format) = match image.pixels { - RGBA8(ref pixels) => (4, pixels.as_slice(), SurfaceFormat::B8G8R8A8), - K8(ref pixels) => (1, pixels.as_slice(), SurfaceFormat::A8), - RGB8(_) => panic!("RGB8 color type not supported"), - KA8(_) => panic!("KA8 color type not supported"), + PixelsByColorType::RGBA8(ref pixels) => (4, pixels.as_slice(), SurfaceFormat::B8G8R8A8), + PixelsByColorType::K8(ref pixels) => (1, pixels.as_slice(), SurfaceFormat::A8), + PixelsByColorType::RGB8(_) => panic!("RGB8 color type not supported"), + PixelsByColorType::KA8(_) => panic!("KA8 color type not supported"), }; let stride = image.width * pixel_width; diff --git a/components/net/image/base.rs b/components/net/image/base.rs index affbd705ae0..684dcac1321 100644 --- a/components/net/image/base.rs +++ b/components/net/image/base.rs @@ -50,8 +50,8 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> { match png::load_png_from_memory(buffer) { Ok(mut png_image) => { match png_image.pixels { - png::RGB8(ref mut data) => byte_swap(data.as_mut_slice()), - png::RGBA8(ref mut data) => { + png::PixelsByColorType::RGB8(ref mut data) => byte_swap(data.as_mut_slice()), + png::PixelsByColorType::RGBA8(ref mut data) => { byte_swap_and_premultiply(data.as_mut_slice()) } _ => {} @@ -72,7 +72,7 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> { Some(png::Image { width: image.width as u32, height: image.height as u32, - pixels: png::RGBA8(image.data) + pixels: png::PixelsByColorType::RGBA8(image.data) }) } stb_image::ImageF32(_image) => { |