Auto merge of #6566 - glennw:image-deps, r=pcwalton

Add servo Image type. Remove rust-png dependency from script, gfx, layout.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6566)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-07-06 13:45:04 -06:00
commit 3a3ac2281b
13 changed files with 67 additions and 60 deletions

View file

@ -48,9 +48,6 @@ git = "https://github.com/servo/rust-selectors"
[dependencies.js]
git = "https://github.com/servo/rust-mozjs"
[dependencies.png]
git = "https://github.com/servo/rust-png"
[dependencies.url]
version = "0.2.33"
features = ["query_encoding"]

View file

@ -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));

View file

@ -48,7 +48,6 @@ extern crate libc;
extern crate msg;
extern crate net_traits;
extern crate num;
extern crate png;
extern crate rustc_serialize;
extern crate time;
extern crate canvas;