Properly double buffering

This commit is contained in:
2025-05-21 15:50:52 -07:00
parent 5b8475f1a3
commit 64fe7ec941
9 changed files with 203 additions and 125 deletions

View File

@@ -1,10 +1,12 @@
use crate::wayland::shm::ShmPool;
use crate::wayland::{shm::ShmPool, wl_shm::wl_buffer};
pub fn color_blend(col1: u32, col2: u32, diff: f64) -> u32 {
// TODO: Account for alpha channel
let a1 = (col1 & 0xff000000) >> 24;
let r1 = (col1 & 0x00ff0000) >> 16;
let g1 = (col1 & 0x0000ff00) >> 8;
let b1 = col1 & 0x000000ff;
let a2 = (col2 & 0xff000000) >> 24;
let r2 = (col2 & 0x00ff0000) >> 16;
let g2 = (col2 & 0x0000ff00) >> 8;
let b2 = col2 & 0x000000ff;
@@ -26,6 +28,7 @@ pub fn color_blend(col1: u32, col2: u32, diff: f64) -> u32 {
return 0xff000000 + (r3 << 16) + (g3 << 8) + b3;
}
pub trait Drawable {
fn draw(&self, shm_pool: &mut ShmPool);
pub trait Drawable : Send {
fn update(&mut self);
fn draw(&self, buffer: &wl_buffer, shm_pool: &mut ShmPool);
}