fix: store single-pixel colors outside of buffer storage
This commit is contained in:
parent
8abaa3ec87
commit
421be6854b
2 changed files with 7 additions and 12 deletions
|
|
@ -27,7 +27,6 @@ use {
|
||||||
pub enum WlBufferStorage {
|
pub enum WlBufferStorage {
|
||||||
Shm { mem: ClientMemOffset, stride: i32 },
|
Shm { mem: ClientMemOffset, stride: i32 },
|
||||||
Dmabuf(Rc<dyn GfxImage>),
|
Dmabuf(Rc<dyn GfxImage>),
|
||||||
Color(Color),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct WlBuffer {
|
pub struct WlBuffer {
|
||||||
|
|
@ -39,6 +38,7 @@ pub struct WlBuffer {
|
||||||
dmabuf: Option<DmaBuf>,
|
dmabuf: Option<DmaBuf>,
|
||||||
render_ctx_version: Cell<u32>,
|
render_ctx_version: Cell<u32>,
|
||||||
pub storage: RefCell<Option<WlBufferStorage>>,
|
pub storage: RefCell<Option<WlBufferStorage>>,
|
||||||
|
pub color: Option<Color>,
|
||||||
pub texture: CloneCell<Option<Rc<dyn GfxTexture>>>,
|
pub texture: CloneCell<Option<Rc<dyn GfxTexture>>>,
|
||||||
pub famebuffer: CloneCell<Option<Rc<dyn GfxFramebuffer>>>,
|
pub famebuffer: CloneCell<Option<Rc<dyn GfxFramebuffer>>>,
|
||||||
width: i32,
|
width: i32,
|
||||||
|
|
@ -75,6 +75,7 @@ impl WlBuffer {
|
||||||
render_ctx_version: Cell::new(client.state.render_ctx_version.get()),
|
render_ctx_version: Cell::new(client.state.render_ctx_version.get()),
|
||||||
storage: RefCell::new(Some(WlBufferStorage::Dmabuf(img.clone()))),
|
storage: RefCell::new(Some(WlBufferStorage::Dmabuf(img.clone()))),
|
||||||
tracker: Default::default(),
|
tracker: Default::default(),
|
||||||
|
color: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,6 +114,7 @@ impl WlBuffer {
|
||||||
texture: CloneCell::new(None),
|
texture: CloneCell::new(None),
|
||||||
tracker: Default::default(),
|
tracker: Default::default(),
|
||||||
famebuffer: Default::default(),
|
famebuffer: Default::default(),
|
||||||
|
color: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -132,14 +134,13 @@ impl WlBuffer {
|
||||||
format: ARGB8888,
|
format: ARGB8888,
|
||||||
dmabuf: None,
|
dmabuf: None,
|
||||||
render_ctx_version: Cell::new(client.state.render_ctx_version.get()),
|
render_ctx_version: Cell::new(client.state.render_ctx_version.get()),
|
||||||
storage: RefCell::new(Some(WlBufferStorage::Color(
|
storage: RefCell::new(None),
|
||||||
Color::from_u32_rgba_premultiplied(r, g, b, a),
|
|
||||||
))),
|
|
||||||
width: 1,
|
width: 1,
|
||||||
height: 1,
|
height: 1,
|
||||||
texture: CloneCell::new(None),
|
texture: CloneCell::new(None),
|
||||||
tracker: Default::default(),
|
tracker: Default::default(),
|
||||||
famebuffer: Default::default(),
|
famebuffer: Default::default(),
|
||||||
|
color: Some(Color::from_u32_rgba_premultiplied(r, g, b, a)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -197,9 +198,6 @@ impl WlBuffer {
|
||||||
self.texture.set(Some(img.clone().to_texture()?));
|
self.texture.set(Some(img.clone().to_texture()?));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WlBufferStorage::Color(_) => {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -219,9 +217,6 @@ impl WlBuffer {
|
||||||
self.famebuffer.set(Some(img.clone().to_framebuffer()?));
|
self.famebuffer.set(Some(img.clone().to_framebuffer()?));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WlBufferStorage::Color(_) => {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use {
|
||||||
format::ARGB8888,
|
format::ARGB8888,
|
||||||
gfx_api::{BufferPoints, GfxApiOpt},
|
gfx_api::{BufferPoints, GfxApiOpt},
|
||||||
ifs::{
|
ifs::{
|
||||||
wl_buffer::{WlBuffer, WlBufferStorage},
|
wl_buffer::WlBuffer,
|
||||||
wl_callback::WlCallback,
|
wl_callback::WlCallback,
|
||||||
wl_surface::{
|
wl_surface::{
|
||||||
xdg_surface::XdgSurface, zwlr_layer_surface_v1::ZwlrLayerSurfaceV1, WlSurface,
|
xdg_surface::XdgSurface, zwlr_layer_surface_v1::ZwlrLayerSurfaceV1, WlSurface,
|
||||||
|
|
@ -400,7 +400,7 @@ impl Renderer<'_> {
|
||||||
max_width,
|
max_width,
|
||||||
max_height,
|
max_height,
|
||||||
);
|
);
|
||||||
} else if let Some(WlBufferStorage::Color(color)) = &*buffer.storage.borrow() {
|
} else if let Some(color) = &buffer.color {
|
||||||
if let Some(rect) =
|
if let Some(rect) =
|
||||||
Rect::new_sized(x, y, tsize.0.min(max_width), tsize.1.min(max_height))
|
Rect::new_sized(x, y, tsize.0.min(max_width), tsize.1.min(max_height))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue