1
0
Fork 0
forked from wry/wry

gfx: remove incompatible shm downloads

This commit is contained in:
Julian Orth 2024-10-06 11:50:11 +02:00
parent 17de1650a0
commit aca14d48dd
7 changed files with 27 additions and 176 deletions

View file

@ -34,29 +34,21 @@ impl Debug for Framebuffer {
}
impl Framebuffer {
pub fn copy_to_shm(
&self,
x: i32,
y: i32,
width: i32,
height: i32,
format: &Format,
shm: &[Cell<u8>],
) -> Result<(), RenderError> {
pub fn copy_to_shm(&self, shm: &[Cell<u8>]) -> Result<(), RenderError> {
let format = self.gl.rb.format;
let Some(shm_info) = &format.shm_info else {
return Err(RenderError::UnsupportedShmFormat(format.name));
};
let gles = self.ctx.ctx.dpy.gles;
let y = self.gl.height - y - height;
let _ = self.ctx.ctx.with_current(|| {
unsafe {
(gles.glBindFramebuffer)(GL_FRAMEBUFFER, self.gl.fbo);
(gles.glViewport)(0, 0, self.gl.width, self.gl.height);
(gles.glReadnPixels)(
x,
y,
width,
height,
0,
0,
self.gl.width,
self.gl.height,
shm_info.gl_format as _,
shm_info.gl_type as _,
shm.len() as _,
@ -112,19 +104,8 @@ impl GfxFramebuffer for Framebuffer {
self.render(acquire_sync, ops, clear).map_err(|e| e.into())
}
fn copy_to_shm(
self: Rc<Self>,
x: i32,
y: i32,
width: i32,
height: i32,
_stride: i32,
format: &'static Format,
shm: &[Cell<u8>],
) -> Result<(), GfxError> {
(*self)
.copy_to_shm(x, y, width, height, format, shm)
.map_err(|e| e.into())
fn copy_to_shm(self: Rc<Self>, shm: &[Cell<u8>]) -> Result<(), GfxError> {
(*self).copy_to_shm(shm).map_err(|e| e.into())
}
fn format(&self) -> &'static Format {