Merge pull request #79 from mahkoh/jorth/spb
fix: store single-pixel colors outside of buffer storage
This commit is contained in:
commit
672ee88d76
2 changed files with 8 additions and 12 deletions
|
|
@ -27,7 +27,6 @@ use {
|
|||
pub enum WlBufferStorage {
|
||||
Shm { mem: ClientMemOffset, stride: i32 },
|
||||
Dmabuf(Rc<dyn GfxImage>),
|
||||
Color(Color),
|
||||
}
|
||||
|
||||
pub struct WlBuffer {
|
||||
|
|
@ -39,6 +38,7 @@ pub struct WlBuffer {
|
|||
dmabuf: Option<DmaBuf>,
|
||||
render_ctx_version: Cell<u32>,
|
||||
pub storage: RefCell<Option<WlBufferStorage>>,
|
||||
pub color: Option<Color>,
|
||||
pub texture: CloneCell<Option<Rc<dyn GfxTexture>>>,
|
||||
pub famebuffer: CloneCell<Option<Rc<dyn GfxFramebuffer>>>,
|
||||
width: i32,
|
||||
|
|
@ -75,6 +75,7 @@ impl WlBuffer {
|
|||
render_ctx_version: Cell::new(client.state.render_ctx_version.get()),
|
||||
storage: RefCell::new(Some(WlBufferStorage::Dmabuf(img.clone()))),
|
||||
tracker: Default::default(),
|
||||
color: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -113,6 +114,7 @@ impl WlBuffer {
|
|||
texture: CloneCell::new(None),
|
||||
tracker: Default::default(),
|
||||
famebuffer: Default::default(),
|
||||
color: None,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -132,14 +134,13 @@ impl WlBuffer {
|
|||
format: ARGB8888,
|
||||
dmabuf: None,
|
||||
render_ctx_version: Cell::new(client.state.render_ctx_version.get()),
|
||||
storage: RefCell::new(Some(WlBufferStorage::Color(
|
||||
Color::from_u32_rgba_premultiplied(r, g, b, a),
|
||||
))),
|
||||
storage: RefCell::new(None),
|
||||
width: 1,
|
||||
height: 1,
|
||||
texture: CloneCell::new(None),
|
||||
tracker: 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()?));
|
||||
}
|
||||
}
|
||||
WlBufferStorage::Color(_) => {
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -219,9 +217,6 @@ impl WlBuffer {
|
|||
self.famebuffer.set(Some(img.clone().to_framebuffer()?));
|
||||
}
|
||||
}
|
||||
WlBufferStorage::Color(_) => {
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use {
|
|||
format::ARGB8888,
|
||||
gfx_api::{BufferPoints, GfxApiOpt},
|
||||
ifs::{
|
||||
wl_buffer::{WlBuffer, WlBufferStorage},
|
||||
wl_buffer::WlBuffer,
|
||||
wl_callback::WlCallback,
|
||||
wl_surface::{
|
||||
xdg_surface::XdgSurface, zwlr_layer_surface_v1::ZwlrLayerSurfaceV1, WlSurface,
|
||||
|
|
@ -93,6 +93,7 @@ impl Renderer<'_> {
|
|||
x + pos.x1() - opos.x1(),
|
||||
y + pos.y1() - opos.y1(),
|
||||
);
|
||||
self.base.ops.push(GfxApiOpt::Sync);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -400,7 +401,7 @@ impl Renderer<'_> {
|
|||
max_width,
|
||||
max_height,
|
||||
);
|
||||
} else if let Some(WlBufferStorage::Color(color)) = &*buffer.storage.borrow() {
|
||||
} else if let Some(color) = &buffer.color {
|
||||
if let Some(rect) =
|
||||
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