fix: image loading

This commit is contained in:
2026-07-04 18:24:49 +02:00
parent c31166c087
commit 96b85f0159
4 changed files with 56 additions and 33 deletions
+3
View File
@@ -103,6 +103,7 @@ impl ImageRenderer {
/// Upload an image to the GPU, creating or updating its texture.
pub fn upload_image(&mut self, device: &wgpu::Device, queue: &wgpu::Queue, image: &ImageData) {
log::debug!("upload_image: id={}, width={}, height={}, data_len={}", image.id, image.width, image.height, image.data.len());
// Get current frame data (handles animation frames automatically)
let data = image.current_frame_data();
@@ -231,6 +232,7 @@ impl ImageRenderer {
pub fn sync_images(&mut self, device: &wgpu::Device, queue: &wgpu::Queue, storage: &mut ImageStorage) {
// Update animations and get list of changed image IDs
let changed_ids = storage.update_animations();
log::debug!("Sync images: changed_ids={:?}, dirty={}", changed_ids, storage.dirty);
// Re-upload frames that changed due to animation
for id in &changed_ids {
@@ -294,6 +296,7 @@ impl ImageRenderer {
// Image spans from visible_row to visible_row + placement.rows
let image_bottom = visible_row + placement.rows as isize;
if image_bottom < 0 || visible_row >= visible_rows as isize {
log::debug!("Image {} culled: visible_row={}, image_bottom={}, visible_rows={}", placement.image_id, visible_row, image_bottom, visible_rows);
continue; // Image is completely off-screen
}