aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/canvasrenderingcontext2d.rs
diff options
context:
space:
mode:
authorGlenn Watson <gw@intuitionlibrary.com>2015-07-07 08:45:01 +1000
committerGlenn Watson <gw@intuitionlibrary.com>2015-07-07 08:45:01 +1000
commit83301ebb75121ae65926f3b98afd3421f7eca601 (patch)
treeae1c661f5ebfd7b3eb2e4e12f7bc163688f21d60 /components/script/dom/canvasrenderingcontext2d.rs
parent0f8095b950dd144497919cfea65a1f154ed3ae9a (diff)
downloadservo-83301ebb75121ae65926f3b98afd3421f7eca601.tar.gz
servo-83301ebb75121ae65926f3b98afd3421f7eca601.zip
Add servo Image type. Remove rust-png dependency from script, gfx, layout.
Diffstat (limited to 'components/script/dom/canvasrenderingcontext2d.rs')
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index af787682719..4d9ea26c6b7 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -35,7 +35,7 @@ use canvas_traits::{LineCapStyle, LineJoinStyle, CompositionOrBlending};
use canvas::canvas_paint_task::CanvasPaintTask;
use net_traits::image_cache_task::{ImageCacheChan, ImageResponse};
-use png::PixelsByColorType;
+use net_traits::image::base::PixelFormat;
use num::{Float, ToPrimitive};
use std::borrow::ToOwned;
@@ -286,11 +286,11 @@ impl CanvasRenderingContext2D {
};
let image_size = Size2D::new(img.width as f64, img.height as f64);
- let image_data = match img.pixels {
- PixelsByColorType::RGBA8(ref pixels) => pixels.to_vec(),
- PixelsByColorType::K8(_) => panic!("K8 color type not supported"),
- PixelsByColorType::RGB8(_) => panic!("RGB8 color type not supported"),
- PixelsByColorType::KA8(_) => panic!("KA8 color type not supported"),
+ let image_data = match img.format {
+ PixelFormat::RGBA8 => img.bytes.to_vec(),
+ PixelFormat::K8 => panic!("K8 color type not supported"),
+ PixelFormat::RGB8 => panic!("RGB8 color type not supported"),
+ PixelFormat::KA8 => panic!("KA8 color type not supported"),
};
return Some((image_data, image_size));