From 0a32441d5d2e5730d42a16bdf8f58d108c65e903 Mon Sep 17 00:00:00 2001 From: Andrew Burns Date: Sat, 25 Jan 2025 14:05:40 -0700 Subject: [PATCH 1/2] Update README.md On a brand new MacBook Sequoia 15.1 I found this was not installed and needed. Technically XCode command line tools are also required; however this is also prerequisite for homebrew so I did not add that. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ac5c182..dca2279 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ Windows: Install Nasm from https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/ Mac: -`brew install nasm` +`brew install nasm cmake` ## Updates From 4a513df80b9152028b5bb2c4944e0bbf65e42b5d Mon Sep 17 00:00:00 2001 From: B-LechCode <31586281+B-LechCode@users.noreply.github.com> Date: Thu, 30 Jan 2025 06:00:08 +0100 Subject: [PATCH 2/2] fix: forgotten early exit feat: error reporting if texture generation for image fails --- src/main.rs | 32 +++++++++++++++++++++----------- src/texture_wrapper.rs | 3 +-- src/ui/edit_ui.rs | 4 +++- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/main.rs b/src/main.rs index d2de4fb..d5e7102 100644 --- a/src/main.rs +++ b/src/main.rs @@ -294,7 +294,7 @@ fn init(_app: &mut App, gfx: &mut Graphics, plugins: &mut Plugins) -> OculanteSt // Set up egui style / theme plugins.egui(|ctx| { // FIXME: Wait for https://github.com/Nazariglez/notan/issues/315 to close, then remove - + let mut fonts = FontDefinitions::default(); egui_extras::install_image_loaders(ctx); @@ -349,10 +349,8 @@ fn init(_app: &mut App, gfx: &mut Graphics, plugins: &mut Plugins) -> OculanteSt .unwrap() .insert(0, "inter".to_owned()); - let fonts = load_system_fonts(fonts); - debug!("Theme {:?}", state.persistent_settings.theme); apply_theme(&mut state, ctx); ctx.set_fonts(fonts); @@ -950,9 +948,13 @@ fn drawe(app: &mut App, gfx: &mut Graphics, plugins: &mut Plugins, state: &mut O debug!("Received image buffer: {:?}", img.dimensions(),); state.image_geometry.dimensions = img.dimensions(); - state - .current_texture - .set_image(&img, gfx, &state.persistent_settings); + if let Err(error) = + state + .current_texture + .set_image(&img, gfx, &state.persistent_settings) + { + state.send_message_warn(&format!("Error while displaying image: {error}")); + } state.current_image = Some(img); } Frame::UpdateTexture => { @@ -960,17 +962,25 @@ fn drawe(app: &mut App, gfx: &mut Graphics, plugins: &mut Plugins, state: &mut O // Prefer the edit result, if present if state.edit_state.result_pixel_op != Default::default() { - state.current_texture.set_image( + if let Err(error) = state.current_texture.set_image( &state.edit_state.result_pixel_op, gfx, &state.persistent_settings, - ); + ) { + state.send_message_warn(&format!("Error while displaying image: {error}")); + } } else { // update from image if let Some(img) = &state.current_image { - state - .current_texture - .set_image(&img, gfx, &state.persistent_settings); + if let Err(error) = + state + .current_texture + .set_image(&img, gfx, &state.persistent_settings) + { + state.send_message_warn(&format!( + "Error while displaying image: {error}" + )); + } } } } diff --git a/src/texture_wrapper.rs b/src/texture_wrapper.rs index dda3aa5..0074a98 100644 --- a/src/texture_wrapper.rs +++ b/src/texture_wrapper.rs @@ -42,9 +42,8 @@ impl TextureWrapperManager { && tex.height() as u32 == img.height() && img.color() == tex.image_format { - debug!("Re-using texture as it is the same size and type."); match tex.update_textures(gfx, img) { - Ok(_) => {} + Ok(_) => return Ok(()), Err(error) => { self.clear(); error!("{error}"); diff --git a/src/ui/edit_ui.rs b/src/ui/edit_ui.rs index 8a81208..82d00bc 100644 --- a/src/ui/edit_ui.rs +++ b/src/ui/edit_ui.rs @@ -330,7 +330,9 @@ pub fn edit_ui(app: &mut App, ctx: &Context, state: &mut OculanteState, gfx: &mu if ui.add(egui::Button::new("Original").min_size(vec2(ui.available_width()/2., 0.))).clicked() { if let Some(img) = &state.current_image { state.image_geometry.dimensions = img.dimensions(); - state.current_texture.set_image(img, gfx, &state.persistent_settings); + if let Err(error) = state.current_texture.set_image(img, gfx, &state.persistent_settings){ + state.send_message_warn(&format!("Error while displaying image: {error}")); + } } } if ui.add(egui::Button::new("Modified").min_size(vec2(ui.available_width(), 0.))).clicked() {