Skip to content

Commit 9781f12

Browse files
committed
delete PixelInfo and just provide pixel_size
1 parent af44e98 commit 9781f12

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

crates/bevy_render/src/texture/image.rs

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -467,34 +467,15 @@ impl Volume for Extent3d {
467467
}
468468
}
469469

470-
/// Information about the pixel size in bytes and the number of different components.
471-
pub struct PixelInfo {
472-
/// The size of a component of a pixel in bytes.
473-
pub type_size: usize,
474-
/// The amount of different components (color channels).
475-
pub num_components: usize,
476-
}
477-
478470
/// Extends the wgpu [`TextureFormat`] with information about the pixel.
479471
pub trait TextureFormatPixelInfo {
480-
/// Returns the pixel information of the format.
481-
fn pixel_info(&self) -> PixelInfo;
482-
/// Returns the size of a pixel of the format.
483-
fn pixel_size(&self) -> usize {
484-
let info = self.pixel_info();
485-
info.type_size * info.num_components
486-
}
472+
/// Returns the size in bytes of a pixel of the format.
473+
fn pixel_size(&self) -> usize;
487474
}
488475

489476
impl TextureFormatPixelInfo for TextureFormat {
490-
#[allow(clippy::match_same_arms)]
491-
fn pixel_info(&self) -> PixelInfo {
492-
let info = self.describe();
493-
494-
PixelInfo {
495-
type_size: info.block_size.into(),
496-
num_components: info.components.into(),
497-
}
477+
fn pixel_size(&self) -> usize {
478+
self.describe().block_size.into()
498479
}
499480
}
500481

0 commit comments

Comments
 (0)