From 57eda2efa1357be8a3473fe45242ffd7bdf27e0b Mon Sep 17 00:00:00 2001 From: SpecificProtagonist Date: Mon, 26 May 2025 19:34:07 +0200 Subject: [PATCH] Remove warning from Image::resize (#19116) # Objective `Image::resize` currently prints a warning when resizing an uninitialized `Image`, even though the resizing works correctly. For [code](https://github.com/bevyengine/bevy/blob/c92f14c9e7adc9f5fc02ec14b26589dd82f8b4eb/crates/bevy_ui/src/widget/viewport.rs#L175-L179) that doesn't care about whether the image is initialized CP-side, this is inconvenient and unnecessary. --- crates/bevy_image/src/image.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/bevy_image/src/image.rs b/crates/bevy_image/src/image.rs index e0c7939ca1..bf569af69e 100644 --- a/crates/bevy_image/src/image.rs +++ b/crates/bevy_image/src/image.rs @@ -15,7 +15,6 @@ use bevy_math::{AspectRatio, UVec2, UVec3, Vec2}; use core::hash::Hash; use serde::{Deserialize, Serialize}; use thiserror::Error; -use tracing::warn; use wgpu_types::{ AddressMode, CompareFunction, Extent3d, Features, FilterMode, SamplerBorderColor, SamplerDescriptor, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages, @@ -850,7 +849,7 @@ impl Image { } /// Resizes the image to the new size, by removing information or appending 0 to the `data`. - /// Does not properly resize the contents of the image, but only its internal `data` buffer. + /// Does not properly scale the contents of the image. pub fn resize(&mut self, size: Extent3d) { self.texture_descriptor.size = size; if let Some(ref mut data) = self.data { @@ -858,8 +857,6 @@ impl Image { size.volume() * self.texture_descriptor.format.pixel_size(), 0, ); - } else { - warn!("Resized an uninitialized image. Directly modify image.texture_descriptor.size instead"); } }