Use RGBA texture for image and svg pipelines
This commit is contained in:
parent
8ce8d374b1
commit
438f97a6d0
4 changed files with 9 additions and 9 deletions
|
|
@ -27,7 +27,7 @@ impl image::Storage for Storage {
|
||||||
width as i32,
|
width as i32,
|
||||||
height as i32,
|
height as i32,
|
||||||
0,
|
0,
|
||||||
glow::BGRA,
|
glow::RGBA,
|
||||||
glow::UNSIGNED_BYTE,
|
glow::UNSIGNED_BYTE,
|
||||||
Some(data),
|
Some(data),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ impl<T: Storage> Cache<T> {
|
||||||
Memory::Invalid
|
Memory::Invalid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
image::Data::Pixels {
|
image::Data::Rgba {
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
pixels,
|
pixels,
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ impl Handle {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates an image [`Handle`] containing the image pixels directly. This
|
/// Creates an image [`Handle`] containing the image pixels directly. This
|
||||||
/// function expects the input data to be provided as a `Vec<u8>` of BGRA
|
/// function expects the input data to be provided as a `Vec<u8>` of RGBA
|
||||||
/// pixels.
|
/// pixels.
|
||||||
///
|
///
|
||||||
/// This is useful if you have already decoded your image.
|
/// This is useful if you have already decoded your image.
|
||||||
|
|
@ -31,7 +31,7 @@ impl Handle {
|
||||||
height: u32,
|
height: u32,
|
||||||
pixels: impl Into<Cow<'static, [u8]>>,
|
pixels: impl Into<Cow<'static, [u8]>>,
|
||||||
) -> Handle {
|
) -> Handle {
|
||||||
Self::from_data(Data::Pixels {
|
Self::from_data(Data::Rgba {
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
pixels: pixels.into(),
|
pixels: pixels.into(),
|
||||||
|
|
@ -93,8 +93,8 @@ pub enum Data {
|
||||||
/// In-memory data
|
/// In-memory data
|
||||||
Bytes(Cow<'static, [u8]>),
|
Bytes(Cow<'static, [u8]>),
|
||||||
|
|
||||||
/// Decoded image pixels in BGRA format.
|
/// Decoded image pixels in RGBA format.
|
||||||
Pixels {
|
Rgba {
|
||||||
/// The width of the image.
|
/// The width of the image.
|
||||||
width: u32,
|
width: u32,
|
||||||
/// The height of the image.
|
/// The height of the image.
|
||||||
|
|
@ -109,7 +109,7 @@ impl std::fmt::Debug for Data {
|
||||||
match self {
|
match self {
|
||||||
Data::Path(path) => write!(f, "Path({:?})", path),
|
Data::Path(path) => write!(f, "Path({:?})", path),
|
||||||
Data::Bytes(_) => write!(f, "Bytes(...)"),
|
Data::Bytes(_) => write!(f, "Bytes(...)"),
|
||||||
Data::Pixels { width, height, .. } => {
|
Data::Rgba { width, height, .. } => {
|
||||||
write!(f, "Pixels({} * {})", width, height)
|
write!(f, "Pixels({} * {})", width, height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ impl Atlas {
|
||||||
mip_level_count: 1,
|
mip_level_count: 1,
|
||||||
sample_count: 1,
|
sample_count: 1,
|
||||||
dimension: wgpu::TextureDimension::D2,
|
dimension: wgpu::TextureDimension::D2,
|
||||||
format: wgpu::TextureFormat::Bgra8UnormSrgb,
|
format: wgpu::TextureFormat::Rgba8UnormSrgb,
|
||||||
usage: wgpu::TextureUsages::COPY_DST
|
usage: wgpu::TextureUsages::COPY_DST
|
||||||
| wgpu::TextureUsages::COPY_SRC
|
| wgpu::TextureUsages::COPY_SRC
|
||||||
| wgpu::TextureUsages::TEXTURE_BINDING,
|
| wgpu::TextureUsages::TEXTURE_BINDING,
|
||||||
|
|
@ -246,7 +246,7 @@ impl Atlas {
|
||||||
mip_level_count: 1,
|
mip_level_count: 1,
|
||||||
sample_count: 1,
|
sample_count: 1,
|
||||||
dimension: wgpu::TextureDimension::D2,
|
dimension: wgpu::TextureDimension::D2,
|
||||||
format: wgpu::TextureFormat::Bgra8UnormSrgb,
|
format: wgpu::TextureFormat::Rgba8UnormSrgb,
|
||||||
usage: wgpu::TextureUsages::COPY_DST
|
usage: wgpu::TextureUsages::COPY_DST
|
||||||
| wgpu::TextureUsages::COPY_SRC
|
| wgpu::TextureUsages::COPY_SRC
|
||||||
| wgpu::TextureUsages::TEXTURE_BINDING,
|
| wgpu::TextureUsages::TEXTURE_BINDING,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue