Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazariglez committed Jan 22, 2023
1 parent 2a314c9 commit 09b5bca
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions crates/notan_glow/src/texture_source.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::texture::{create_texture, TextureKey};
use crate::GlowBackend;
use image::ImageBuffer;
use notan_graphics::color::Color;
use notan_graphics::{TextureFormat, TextureInfo};

Expand All @@ -19,7 +18,7 @@ pub(crate) fn add_texture_from_image(
mut info: TextureInfo,
) -> Result<(u64, TextureInfo), String> {
let img = image::load_from_memory(&buffer).map_err(|e| e.to_string())?;
let (tex, width, height) = parse_image(backend, &img, &mut info)?;
let tex = parse_image(backend, &img, &mut info)?;
let id = backend.add_inner_texture(tex, &info)?;
Ok((id, info))
}
Expand All @@ -28,7 +27,7 @@ fn parse_image(
backend: &mut GlowBackend,
img: &image::DynamicImage,
info: &mut TextureInfo,
) -> Result<(TextureKey, i32, i32), String> {
) -> Result<TextureKey, String> {
// TODO process the loading of more texture types directly?
match info.format {
TextureFormat::Rgba32Float => {
Expand All @@ -43,8 +42,8 @@ fn parse_image(
info.width = width;
info.height = height;
let tex =
unsafe { create_texture(&backend.gl, Some(bytemuck::cast_slice(&data)), &info)? };
Ok((tex, width, height))
unsafe { create_texture(&backend.gl, Some(bytemuck::cast_slice(&data)), info)? };
Ok(tex)
}
_ => {
let mut data = img.to_rgba8();
Expand All @@ -58,8 +57,8 @@ fn parse_image(
info.width = width;
info.height = height;
let tex =
unsafe { create_texture(&backend.gl, Some(bytemuck::cast_slice(&data)), &info)? };
Ok((tex, width, height))
unsafe { create_texture(&backend.gl, Some(bytemuck::cast_slice(&data)), info)? };
Ok(tex)
}
}
}
Expand Down

0 comments on commit 09b5bca

Please sign in to comment.