mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
auto merge of #2378 : glennw/servo/png-update, r=larsbergstrom
... submodule pointers.
This commit is contained in:
commit
146eccdf80
4 changed files with 6 additions and 6 deletions
|
@ -105,7 +105,7 @@ impl<'a> RenderContext<'a> {
|
||||||
|
|
||||||
self.draw_target.make_current();
|
self.draw_target.make_current();
|
||||||
let draw_target_ref = &self.draw_target;
|
let draw_target_ref = &self.draw_target;
|
||||||
let azure_surface = draw_target_ref.create_source_surface_from_data(image.pixels, size,
|
let azure_surface = draw_target_ref.create_source_surface_from_data(image.pixels.as_slice(), size,
|
||||||
stride as i32, B8G8R8A8);
|
stride as i32, B8G8R8A8);
|
||||||
let source_rect = Rect(Point2D(0 as AzFloat, 0 as AzFloat),
|
let source_rect = Rect(Point2D(0 as AzFloat, 0 as AzFloat),
|
||||||
Size2D(image.width as AzFloat, image.height as AzFloat));
|
Size2D(image.width as AzFloat, image.height as AzFloat));
|
||||||
|
|
|
@ -10,7 +10,7 @@ use png;
|
||||||
// reference count them.
|
// reference count them.
|
||||||
pub type Image = png::Image;
|
pub type Image = png::Image;
|
||||||
|
|
||||||
pub fn Image(width: u32, height: u32, color_type: png::ColorType, data: ~[u8]) -> Image {
|
pub fn Image(width: u32, height: u32, color_type: png::ColorType, data: Vec<u8>) -> Image {
|
||||||
png::Image {
|
png::Image {
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
|
@ -44,7 +44,7 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> {
|
||||||
if png::is_png(buffer) {
|
if png::is_png(buffer) {
|
||||||
match png::load_png_from_memory(buffer) {
|
match png::load_png_from_memory(buffer) {
|
||||||
Ok(mut png_image) => {
|
Ok(mut png_image) => {
|
||||||
byte_swap(png_image.color_type, png_image.pixels);
|
byte_swap(png_image.color_type, png_image.pixels.as_mut_slice());
|
||||||
Some(png_image)
|
Some(png_image)
|
||||||
}
|
}
|
||||||
Err(_err) => None,
|
Err(_err) => None,
|
||||||
|
@ -57,7 +57,7 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> {
|
||||||
match stb_image::load_from_memory_with_depth(buffer, FORCE_DEPTH, true) {
|
match stb_image::load_from_memory_with_depth(buffer, FORCE_DEPTH, true) {
|
||||||
stb_image::ImageU8(mut image) => {
|
stb_image::ImageU8(mut image) => {
|
||||||
assert!(image.depth == 4);
|
assert!(image.depth == 4);
|
||||||
byte_swap(png::RGBA8, image.data);
|
byte_swap(png::RGBA8, image.data.as_mut_slice());
|
||||||
Some(Image(image.width as u32, image.height as u32, png::RGBA8, image.data))
|
Some(Image(image.width as u32, image.height as u32, png::RGBA8, image.data))
|
||||||
}
|
}
|
||||||
stb_image::ImageF32(_image) => fail!("HDR images not implemented"),
|
stb_image::ImageF32(_image) => fail!("HDR images not implemented"),
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit fc6103e7670222459ffd0b53ac9625d4bddb857c
|
Subproject commit 8d75c64ac6bc0b06d08e5c859dc792f771336064
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7076b1b2c5ddf08327dfb8b1232dc0b919685e68
|
Subproject commit d849f6de5abfd601381826822094640df0e74a2a
|
Loading…
Add table
Add a link
Reference in a new issue