mirror of
https://github.com/servo/servo.git
synced 2025-08-09 23:45:35 +01:00
Update image/png.
This commit is contained in:
parent
2059f117b4
commit
369a5c0370
10 changed files with 209 additions and 64 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
use crate::image_cache::CorsStatus;
|
||||
use ipc_channel::ipc::IpcSharedMemory;
|
||||
use piston_image::{DynamicImage, ImageFormat};
|
||||
use piston_image::ImageFormat;
|
||||
use pixels::PixelFormat;
|
||||
use std::fmt;
|
||||
|
||||
|
@ -52,10 +52,7 @@ pub fn load_from_memory(buffer: &[u8], cors_status: CorsStatus) -> Option<Image>
|
|||
},
|
||||
Ok(_) => match piston_image::load_from_memory(buffer) {
|
||||
Ok(image) => {
|
||||
let mut rgba = match image {
|
||||
DynamicImage::ImageRgba8(rgba) => rgba,
|
||||
image => image.to_rgba(),
|
||||
};
|
||||
let mut rgba = image.into_rgba8();
|
||||
pixels::rgba8_byte_swap_colors_inplace(&mut *rgba);
|
||||
Some(Image {
|
||||
width: rgba.width(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue