Skip to content

Commit

Permalink
i -> image
Browse files Browse the repository at this point in the history
  • Loading branch information
robtfm committed Sep 5, 2023
1 parent 4e85bcf commit a17af45
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions crates/bevy_render/src/texture/image_texture_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ impl Image {
let format: TextureFormat;

match dyn_img {
DynamicImage::ImageLuma8(i) => {
let i = DynamicImage::ImageLuma8(i).into_rgba8();
DynamicImage::ImageLuma8(image) => {
let i = DynamicImage::ImageLuma8(image).into_rgba8();
width = i.width();
height = i.height();
format = if is_srgb {
Expand All @@ -26,8 +26,8 @@ impl Image {

data = i.into_raw();
}
DynamicImage::ImageLumaA8(i) => {
let i = DynamicImage::ImageLumaA8(i).into_rgba8();
DynamicImage::ImageLumaA8(image) => {
let i = DynamicImage::ImageLumaA8(image).into_rgba8();
width = i.width();
height = i.height();
format = if is_srgb {
Expand All @@ -38,8 +38,8 @@ impl Image {

data = i.into_raw();
}
DynamicImage::ImageRgb8(i) => {
let i = DynamicImage::ImageRgb8(i).into_rgba8();
DynamicImage::ImageRgb8(image) => {
let i = DynamicImage::ImageRgb8(image).into_rgba8();
width = i.width();
height = i.height();
format = if is_srgb {
Expand All @@ -50,37 +50,37 @@ impl Image {

data = i.into_raw();
}
DynamicImage::ImageRgba8(i) => {
width = i.width();
height = i.height();
DynamicImage::ImageRgba8(image) => {
width = image.width();
height = image.height();
format = if is_srgb {
TextureFormat::Rgba8UnormSrgb
} else {
TextureFormat::Rgba8Unorm
};

data = i.into_raw();
data = image.into_raw();
}
DynamicImage::ImageLuma16(i) => {
width = i.width();
height = i.height();
DynamicImage::ImageLuma16(image) => {
width = image.width();
height = image.height();
format = TextureFormat::R16Uint;

let raw_data = i.into_raw();
let raw_data = image.into_raw();

data = cast_slice(&raw_data).to_owned();
}
DynamicImage::ImageLumaA16(i) => {
width = i.width();
height = i.height();
DynamicImage::ImageLumaA16(image) => {
width = image.width();
height = image.height();
format = TextureFormat::Rg16Uint;

let raw_data = i.into_raw();
let raw_data = image.into_raw();

data = cast_slice(&raw_data).to_owned();
}
DynamicImage::ImageRgb16(i) => {
let i = DynamicImage::ImageRgb16(i).into_rgba16();
DynamicImage::ImageRgb16(image) => {
let i = DynamicImage::ImageRgb16(image).into_rgba16();
width = i.width();
height = i.height();
format = TextureFormat::Rgba16Unorm;
Expand All @@ -89,12 +89,12 @@ impl Image {

data = cast_slice(&raw_data).to_owned();
}
DynamicImage::ImageRgba16(i) => {
width = i.width();
height = i.height();
DynamicImage::ImageRgba16(image) => {
width = image.width();
height = image.height();
format = TextureFormat::Rgba16Unorm;

let raw_data = i.into_raw();
let raw_data = image.into_raw();

data = cast_slice(&raw_data).to_owned();
}
Expand Down

0 comments on commit a17af45

Please sign in to comment.