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](c92f14c9e7/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.
This commit is contained in:
SpecificProtagonist 2025-05-26 19:34:07 +02:00 committed by GitHub
parent c84a808f80
commit 57eda2efa1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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");
}
}