From f4f8c0687c089ef037924882964b64e229ab9ee1 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Thu, 23 Jul 2026 03:41:52 +0300 Subject: [PATCH] fix(image): stop darkening rasters; X only for broken references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Image textures were created Rgba8UnormSrgb: sampling decoded sRGB to linear, but the surface isn't sRGB, so every raster (images, OLE, PDF underlays) rendered visibly dark. Rgba8Unorm passes the texels through in the same space as every other colour in the app. The frame wire also always carried the X diagonals — that's the broken-reference placeholder, and it scribbled over resolvable images. The diagonals now draw only when the reference doesn't resolve. Co-Authored-By: Claude Fable 5 --- src/entities/raster_image.rs | 9 +++++++-- src/scene/pipeline/image_gpu.rs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/entities/raster_image.rs b/src/entities/raster_image.rs index 377353338..4bc1444b1 100644 --- a/src/entities/raster_image.rs +++ b/src/entities/raster_image.rs @@ -93,6 +93,11 @@ impl TruckConvertible for RasterImage { // place the boundary where AutoCAD draws it. Must match the raster's // own clip triangulation in `ImageModel` so outline and pixels align. let ih = self.size.y; + // Diagonals are the BROKEN-reference placeholder; a resolvable image + // draws its pixels inside the frame, so the X would scribble over it. + let path_probe = self.file_path.trim(); + let resolvable = path_probe.is_empty() + || crate::scene::model::image_model::resolve_image(path_probe).is_some(); let pts = if self.clipping_enabled { let cb = &self.clip_boundary; match cb.clip_type { @@ -116,10 +121,10 @@ impl TruckConvertible for RasterImage { let c3 = px_to_world(xa, yb); vec![c0, c1, c2, c3, c0] } - _ => image_wire(corners, true), + _ => image_wire(corners, !resolvable), } } else { - image_wire(corners, true) + image_wire(corners, !resolvable) }; // A raster OCS can display renders its pixels (built separately) inside diff --git a/src/scene/pipeline/image_gpu.rs b/src/scene/pipeline/image_gpu.rs index cd8959dd1..c196cf783 100644 --- a/src/scene/pipeline/image_gpu.rs +++ b/src/scene/pipeline/image_gpu.rs @@ -94,7 +94,7 @@ impl ImageGpu { mip_level_count: 1, sample_count: 1, dimension: wgpu::TextureDimension::D2, - format: wgpu::TextureFormat::Rgba8UnormSrgb, + format: wgpu::TextureFormat::Rgba8Unorm, usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST, view_formats: &[], });