1
0
Fork 0
forked from wry/wry

theme: store colors in linear space

This commit is contained in:
Julian Orth 2025-02-25 15:43:05 +01:00
parent b7f93b37a6
commit 135f37dbcd
27 changed files with 221 additions and 135 deletions

View file

@ -4,7 +4,7 @@ use {
globals::{Global, GlobalName},
leaks::Tracker,
object::{Object, Version},
theme::Color,
theme::{Color, TransferFunction},
wire::{
JayCompositorId,
jay_damage_tracking::{
@ -96,12 +96,8 @@ impl JayDamageTrackingRequestHandler for JayDamageTracking {
req: SetVisualizerColor,
_slf: &Rc<Self>,
) -> Result<(), Self::Error> {
self.client.state.damage_visualizer.set_color(Color {
r: req.r,
g: req.g,
b: req.b,
a: req.a,
});
let color = Color::new(TransferFunction::Srgb, req.r, req.g, req.b) * req.a;
self.client.state.damage_visualizer.set_color(color);
Ok(())
}

View file

@ -8,7 +8,6 @@ use {
leaks::Tracker,
object::{Object, Version},
rect::{Rect, Region},
theme::Color,
utils::errorfmt::ErrorFmt,
video::dmabuf::DmaBuf,
wire::{WlBufferId, wl_buffer::*},
@ -42,7 +41,7 @@ pub struct WlBuffer {
render_ctx_version: Cell<u32>,
pub storage: RefCell<Option<WlBufferStorage>>,
shm: bool,
pub color: Option<Color>,
pub color: Option<[u32; 4]>,
width: i32,
height: i32,
pub tracker: Tracker<Self>,
@ -149,7 +148,7 @@ impl WlBuffer {
width: 1,
height: 1,
tracker: Default::default(),
color: Some(Color::from_u32_rgba_premultiplied(r, g, b, a)),
color: Some([r, g, b, a]),
}
}