Skip to content

Commit

Permalink
Rename GpuImage::size() to size_2d() for disambiguation
Browse files Browse the repository at this point in the history
  • Loading branch information
Noxmore committed Dec 14, 2024
1 parent 1794653 commit f2ecdb7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_render/src/texture/gpu_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl GpuImage {

/// Returns the size of a 2D image.
#[inline]
pub fn size(&self) -> UVec2 {
pub fn size_2d(&self) -> UVec2 {
UVec2::new(self.size.width, self.size.height)
}
}
2 changes: 1 addition & 1 deletion crates/bevy_sprite/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ pub fn prepare_sprite_image_bind_groups(
continue;
};

batch_image_size = gpu_image.size().as_vec2();
batch_image_size = gpu_image.size_2d().as_vec2();
batch_image_handle = extracted_sprite.image_handle_id;
image_bind_groups
.values
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ui/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ pub fn prepare_uinodes(
);
// Rescale atlases. This is done here because we need texture data that might not be available in Extract.
let atlas_extent = atlas_scaling
.map(|scaling| image.size().as_vec2() * scaling)
.map(|scaling| image.size_2d().as_vec2() * scaling)
.unwrap_or(uinode_rect.max);
if *flip_x {
core::mem::swap(&mut uinode_rect.max.x, &mut uinode_rect.min.x);
Expand Down Expand Up @@ -1127,7 +1127,7 @@ pub fn prepare_uinodes(
.get(extracted_uinode.image)
.expect("Image was checked during batching and should still exist");

let atlas_extent = image.size().as_vec2() * *atlas_scaling;
let atlas_extent = image.size_2d().as_vec2() * *atlas_scaling;

let color = extracted_uinode.color.to_f32_array();
for glyph in &extracted_uinodes.glyphs[range.clone()] {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ pub fn prepare_ui_slices(
if let Some(gpu_image) = gpu_images.get(texture_slices.image) {
batch_item_index = item_index;
batch_image_handle = texture_slices.image;
batch_image_size = gpu_image.size().as_vec2();
batch_image_size = gpu_image.size_2d().as_vec2();

let new_batch = UiTextureSlicerBatch {
range: vertices_index..vertices_index,
Expand Down Expand Up @@ -475,7 +475,7 @@ pub fn prepare_ui_slices(
{
if let Some(gpu_image) = gpu_images.get(texture_slices.image) {
batch_image_handle = texture_slices.image;
batch_image_size = gpu_image.size().as_vec2();
batch_image_size = gpu_image.size_2d().as_vec2();
existing_batch.as_mut().unwrap().1.image = texture_slices.image;

image_bind_groups
Expand Down

0 comments on commit f2ecdb7

Please sign in to comment.