forked from 1b-agent/opencadstudio-upstream
fix(image): stop darkening rasters; X only for broken references
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 <[email protected]>
This commit is contained in:
1 parent
1e913e9e78
commit
f4f8c0687c
2 files changed
+8
-3
No files matched your search
@@ -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
|
||||
|
||||
@@ -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: &[],
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user