From 4d57267f2e51bebaba17fac515541933f12625ff Mon Sep 17 00:00:00 2001 From: David Huculak Date: Tue, 9 Jul 2024 13:34:25 -0400 Subject: [PATCH] upgrade image crate to 0.25 --- Cargo.lock | 30 +++++------------------------- Cargo.toml | 2 +- ikari/src/asset_loader.rs | 15 ++++++++------- 3 files changed, 14 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3d0895e..bb9e676 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -217,7 +217,7 @@ checksum = "9fb4009533e8ff8f1450a5bcbc30f4242a1d34442221f72314bea1f5dc9c7f89" dependencies = [ "clipboard-win", "core-graphics", - "image 0.25.1", + "image", "log", "objc2 0.5.2", "objc2-app-kit", @@ -808,7 +808,7 @@ dependencies = [ "env_logger", "gltf", "ikari", - "image 0.24.9", + "image", "lazy_static", "log", "num_cpus", @@ -867,12 +867,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - [[package]] name = "colorchoice" version = "1.0.1" @@ -1386,7 +1380,7 @@ dependencies = [ "iced_wgpu", "iced_winit", "ikari", - "image 0.24.9", + "image", "lazy_static", "log", "plotters", @@ -1839,7 +1833,7 @@ dependencies = [ "base64 0.13.1", "byteorder", "gltf-json", - "image 0.25.1", + "image", "lazy_static", "serde_json", "urlencoding", @@ -2406,7 +2400,7 @@ dependencies = [ "iced", "iced_wgpu", "iced_winit", - "image 0.24.9", + "image", "js-sys", "lazy_static", "log", @@ -2436,20 +2430,6 @@ dependencies = [ "winit", ] -[[package]] -name = "image" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "jpeg-decoder", - "num-traits", - "png", -] - [[package]] name = "image" version = "0.25.1" diff --git a/Cargo.toml b/Cargo.toml index 3aab54a..24f6d82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ env_logger = { version = "0.11", default-features = false, features = [ "humantime", ] } profiling = "=1.0.14" -image = { version = "0.24", default-features = false, features = [ +image = { version = "0.25", default-features = false, features = [ "hdr", "jpeg", "png", diff --git a/ikari/src/asset_loader.rs b/ikari/src/asset_loader.rs index 67922c8..61d6a1c 100644 --- a/ikari/src/asset_loader.rs +++ b/ikari/src/asset_loader.rs @@ -46,7 +46,6 @@ use crate::wasm_not_sync::{WasmNotSend, WasmNotSync}; use anyhow::bail; use anyhow::Result; -use image::Pixel; use std::collections::HashMap; use std::collections::hash_map::Entry; @@ -611,12 +610,14 @@ pub async fn make_bindable_skybox(paths: &SkyboxPaths) -> Result (metadata.width, metadata.height) }; let skybox_rad_texture_decoded: Vec = { - let rgb_values = skybox_rad_texture_decoder.read_image_hdr()?; - rgb_values - .iter() - .copied() - .flat_map(|rbg| rbg.to_rgba().0.into_iter().map(F16::from)) - .collect() + let dynamic_img = image::DynamicImage::from_decoder(skybox_rad_texture_decoder)?; + let image::DynamicImage::ImageRgb32F(img) = dynamic_img else { + anyhow::bail!( + "Expected HDR image to decode into rgb32f but it was {:?}", + dynamic_img.color(), + ); + }; + img.iter().copied().map(F16::from).collect() }; bindable_environment_hdr =