gles2: Expose transformation of a `Frame`

This commit is contained in:
Victor Brekenfeld 2022-01-10 19:16:30 +01:00
parent 74162a73b6
commit bffae036f7
3 changed files with 13 additions and 0 deletions

View File

@ -186,6 +186,7 @@ pub struct Gles2Renderer {
/// Handle to the currently rendered frame during [`Gles2Renderer::render`](Renderer::render)
pub struct Gles2Frame {
current_projection: Matrix3<f32>,
transform: Transform,
gl: ffi::Gles2,
tex_programs: [Gles2TexProgram; shaders::FRAGMENT_COUNT],
solid_program: Gles2SolidProgram,
@ -1129,6 +1130,7 @@ impl Renderer for Gles2Renderer {
solid_program: self.solid_program.clone(),
// output transformation passed in by the user
current_projection: flip180 * transform.matrix() * renderer,
transform,
vbos: self.vbos,
size,
};
@ -1318,6 +1320,10 @@ impl Frame for Gles2Frame {
self.render_texture(texture, mat, Some(&damage), tex_verts, alpha)
}
fn transformation(&self) -> Transform {
self.transform
}
}
impl Gles2Frame {

View File

@ -219,6 +219,9 @@ pub trait Frame {
src_transform: Transform,
alpha: f32,
) -> Result<(), Self::Error>;
/// Output transformation that is applied to this frame
fn transformation(&self) -> Transform;
}
/// Abstraction of commonly used rendering operations for compositors.

View File

@ -112,6 +112,10 @@ impl Frame for DummyFrame {
) -> Result<(), Self::Error> {
Ok(())
}
fn transformation(&self) -> Transform {
Transform::Normal
}
}
pub struct DummyTexture {