Bump image crate (#13397)

Bumping the image crate for better support of image formats.

The latest version does not have a `BGRA` type it only has `RGBA` it
doesn't really matter as the size is the same but the type name is a
little confusing as we need it as `BGRA`. Also there is no `into_bgra8`
but we can use `into_rgba8` but then it must be converted before
creating the `ImageData`.

Release Notes:

- N/A
This commit is contained in:
Matin Aniss 2024-06-25 23:12:45 +10:00 committed by GitHub
parent 55511d1591
commit 54afa6f69f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 346 additions and 94 deletions

View file

@ -1,6 +1,6 @@
use crate::{size, DevicePixels, Result, SharedString, Size};
use image::{Bgra, ImageBuffer};
use image::RgbaImage;
use std::{
borrow::Cow,
fmt,
@ -40,12 +40,12 @@ pub(crate) struct RenderImageParams {
pub struct ImageData {
/// The ID associated with this image
pub id: ImageId,
data: ImageBuffer<Bgra<u8>, Vec<u8>>,
data: RgbaImage,
}
impl ImageData {
/// Create a new image from the given data.
pub fn new(data: ImageBuffer<Bgra<u8>, Vec<u8>>) -> Self {
pub fn new(data: RgbaImage) -> Self {
static NEXT_ID: AtomicUsize = AtomicUsize::new(0);
Self {