theme: store colors in linear space
This commit is contained in:
parent
b7f93b37a6
commit
135f37dbcd
27 changed files with 221 additions and 135 deletions
|
|
@ -84,7 +84,7 @@ use {
|
|||
GL_TRIANGLE_STRIP, GL_TRIANGLES,
|
||||
},
|
||||
},
|
||||
theme::Color,
|
||||
theme::{Color, TransferFunction},
|
||||
utils::{errorfmt::ErrorFmt, rc_eq::rc_eq, vecstorage::VecStorage},
|
||||
video::{
|
||||
dmabuf::DMA_BUF_SYNC_READ,
|
||||
|
|
@ -305,10 +305,11 @@ fn run_ops(fb: &Framebuffer, ops: &[GfxApiOpt]) -> Option<SyncFile> {
|
|||
}
|
||||
|
||||
fn fill_boxes3(ctx: &GlRenderContext, boxes: &[[f32; 2]], color: &Color) {
|
||||
let [r, g, b, a] = color.to_array(TransferFunction::Srgb);
|
||||
let gles = ctx.ctx.dpy.gles;
|
||||
unsafe {
|
||||
(gles.glUseProgram)(ctx.fill_prog.prog);
|
||||
(gles.glUniform4f)(ctx.fill_prog_color, color.r, color.g, color.b, color.a);
|
||||
(gles.glUniform4f)(ctx.fill_prog_color, r, g, b, a);
|
||||
(gles.glVertexAttribPointer)(
|
||||
ctx.fill_prog_pos as _,
|
||||
2,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use {
|
|||
sys::{GL_ONE, GL_ONE_MINUS_SRC_ALPHA},
|
||||
},
|
||||
rect::Region,
|
||||
theme::Color,
|
||||
theme::{Color, TransferFunction},
|
||||
},
|
||||
std::{
|
||||
cell::Cell,
|
||||
|
|
@ -78,7 +78,8 @@ impl Framebuffer {
|
|||
(gles.glBindFramebuffer)(GL_FRAMEBUFFER, self.gl.fbo);
|
||||
(gles.glViewport)(0, 0, self.gl.width, self.gl.height);
|
||||
if let Some(c) = clear {
|
||||
(gles.glClearColor)(c.r, c.g, c.b, c.a);
|
||||
let [r, g, b, a] = c.to_array(TransferFunction::Srgb);
|
||||
(gles.glClearColor)(r, g, b, a);
|
||||
(gles.glClear)(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
(gles.glBlendFunc)(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ use {
|
|||
},
|
||||
io_uring::IoUring,
|
||||
rect::{Rect, Region},
|
||||
theme::Color,
|
||||
theme::{Color, TransferFunction},
|
||||
utils::{
|
||||
copyhashmap::CopyHashMap, errorfmt::ErrorFmt, numcell::NumCell, once::Once,
|
||||
stack::Stack,
|
||||
|
|
@ -589,8 +589,8 @@ impl VulkanRenderer {
|
|||
let clear_value = ClearValue {
|
||||
color: ClearColorValue {
|
||||
float32: match pass {
|
||||
RenderPass::BlendBuffer => clear.to_array_linear(None),
|
||||
RenderPass::FrameBuffer => clear.to_array_srgb(None),
|
||||
RenderPass::BlendBuffer => clear.to_array(TransferFunction::Linear),
|
||||
RenderPass::FrameBuffer => clear.to_array(TransferFunction::Srgb),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -704,8 +704,12 @@ impl VulkanRenderer {
|
|||
let push = FillPushConstants {
|
||||
pos: r.rect.to_points(),
|
||||
color: match pass {
|
||||
RenderPass::BlendBuffer => r.color.to_array_linear(r.alpha),
|
||||
RenderPass::FrameBuffer => r.color.to_array_srgb(r.alpha),
|
||||
RenderPass::BlendBuffer => {
|
||||
r.color.to_array2(TransferFunction::Linear, r.alpha)
|
||||
}
|
||||
RenderPass::FrameBuffer => {
|
||||
r.color.to_array2(TransferFunction::Srgb, r.alpha)
|
||||
}
|
||||
},
|
||||
};
|
||||
let source_type = match push.color[3] < 1.0 {
|
||||
|
|
@ -1309,7 +1313,7 @@ impl VulkanRenderer {
|
|||
for opt in opts.iter().rev() {
|
||||
let (opaque, fb_rect) = match opt {
|
||||
GfxApiOpt::Sync => continue,
|
||||
GfxApiOpt::FillRect(f) => (f.effective_color().a >= 1.0, f.rect),
|
||||
GfxApiOpt::FillRect(f) => (f.effective_color().is_opaque(), f.rect),
|
||||
GfxApiOpt::CopyTexture(c) => {
|
||||
let opaque = 'opaque: {
|
||||
if let Some(a) = c.alpha {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue