mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Add servo Image type. Remove rust-png dependency from script, gfx, layout.
This commit is contained in:
parent
0f8095b950
commit
83301ebb75
13 changed files with 67 additions and 60 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue