anvil: Use buffer transformations
This commit is contained in:
parent
439d5a7820
commit
4b22624e74
|
@ -7,9 +7,11 @@ use image::{ImageBuffer, Rgba};
|
|||
use slog::Logger;
|
||||
#[cfg(feature = "image")]
|
||||
use smithay::backend::renderer::gles2::{Gles2Error, Gles2Renderer, Gles2Texture};
|
||||
#[cfg(feature = "debug")]
|
||||
use smithay::utils::Transform;
|
||||
use smithay::{
|
||||
backend::{
|
||||
renderer::{buffer_type, BufferType, Frame, ImportAll, Renderer, Texture, Transform},
|
||||
renderer::{buffer_type, BufferType, Frame, ImportAll, Renderer, Texture},
|
||||
SwapBuffersError,
|
||||
},
|
||||
reexports::wayland_server::protocol::{wl_buffer, wl_surface},
|
||||
|
@ -111,7 +113,11 @@ where
|
|||
.map(|dmg| match dmg {
|
||||
Damage::Buffer(rect) => *rect,
|
||||
// TODO also apply transformations
|
||||
Damage::Surface(rect) => rect.to_buffer(attributes.buffer_scale),
|
||||
Damage::Surface(rect) => rect.to_buffer(
|
||||
attributes.buffer_scale,
|
||||
attributes.buffer_transform.into(),
|
||||
&data.size().unwrap(),
|
||||
),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
|
@ -161,6 +167,7 @@ where
|
|||
if let Some(data) = states.data_map.get::<RefCell<SurfaceData>>() {
|
||||
let mut data = data.borrow_mut();
|
||||
let buffer_scale = data.buffer_scale;
|
||||
let buffer_transform = data.buffer_transform;
|
||||
if let Some(texture) = data
|
||||
.texture
|
||||
.as_mut()
|
||||
|
@ -177,7 +184,7 @@ where
|
|||
location.to_f64().to_physical(output_scale as f64).to_i32_round(),
|
||||
buffer_scale,
|
||||
output_scale as f64,
|
||||
Transform::Normal, /* TODO */
|
||||
buffer_transform,
|
||||
&[Rectangle::from_loc_and_size((0, 0), (i32::MAX, i32::MAX))],
|
||||
1.0,
|
||||
) {
|
||||
|
|
|
@ -13,7 +13,7 @@ use smithay::{
|
|||
Display,
|
||||
},
|
||||
},
|
||||
utils::{Logical, Physical, Point, Rectangle, Size},
|
||||
utils::{Buffer, Logical, Point, Rectangle, Size, Transform},
|
||||
wayland::{
|
||||
compositor::{
|
||||
compositor_init, is_sync_subsurface, with_states, with_surface_tree_upward, BufferAssignment,
|
||||
|
@ -947,8 +947,9 @@ pub struct SurfaceData {
|
|||
pub texture: Option<Box<dyn std::any::Any + 'static>>,
|
||||
pub geometry: Option<Rectangle<i32, Logical>>,
|
||||
pub resize_state: ResizeState,
|
||||
pub buffer_dimensions: Option<Size<i32, Physical>>,
|
||||
pub buffer_dimensions: Option<Size<i32, Buffer>>,
|
||||
pub buffer_scale: i32,
|
||||
pub buffer_transform: Transform,
|
||||
}
|
||||
|
||||
impl SurfaceData {
|
||||
|
@ -958,6 +959,7 @@ impl SurfaceData {
|
|||
// new contents
|
||||
self.buffer_dimensions = buffer_dimensions(&buffer);
|
||||
self.buffer_scale = attrs.buffer_scale;
|
||||
self.buffer_transform = attrs.buffer_transform.into();
|
||||
if let Some(old_buffer) = std::mem::replace(&mut self.buffer, Some(buffer)) {
|
||||
old_buffer.release();
|
||||
}
|
||||
|
@ -976,7 +978,7 @@ impl SurfaceData {
|
|||
/// Returns the size of the surface.
|
||||
pub fn size(&self) -> Option<Size<i32, Logical>> {
|
||||
self.buffer_dimensions
|
||||
.map(|dims| dims.to_logical(self.buffer_scale))
|
||||
.map(|dims| dims.to_logical(self.buffer_scale, self.buffer_transform))
|
||||
}
|
||||
|
||||
/// Checks if the surface's input region contains the point.
|
||||
|
|
|
@ -20,7 +20,7 @@ use smithay::{
|
|||
libinput::{LibinputInputBackend, LibinputSessionInterface},
|
||||
renderer::{
|
||||
gles2::{Gles2Renderer, Gles2Texture},
|
||||
Bind, Frame, Renderer, Transform,
|
||||
Bind, Frame, Renderer,
|
||||
},
|
||||
session::{auto::AutoSession, Session, Signal as SessionSignal},
|
||||
udev::{UdevBackend, UdevEvent},
|
||||
|
@ -50,7 +50,7 @@ use smithay::{
|
|||
},
|
||||
utils::{
|
||||
signaling::{Linkable, SignalToken, Signaler},
|
||||
Logical, Point, Rectangle,
|
||||
Logical, Point, Rectangle, Transform,
|
||||
},
|
||||
wayland::{
|
||||
output::{Mode, PhysicalProperties},
|
||||
|
|
|
@ -9,7 +9,7 @@ use smithay::{
|
|||
};
|
||||
use smithay::{
|
||||
backend::{
|
||||
renderer::{Renderer, Transform},
|
||||
renderer::Renderer,
|
||||
winit::{self, WinitEvent},
|
||||
SwapBuffersError,
|
||||
},
|
||||
|
@ -17,6 +17,7 @@ use smithay::{
|
|||
calloop::EventLoop,
|
||||
wayland_server::{protocol::wl_output, Display},
|
||||
},
|
||||
utils::Transform,
|
||||
wayland::{
|
||||
output::{Mode, PhysicalProperties},
|
||||
seat::CursorImageStatus,
|
||||
|
|
|
@ -11,7 +11,7 @@ use smithay::{backend::renderer::ImportDma, wayland::dmabuf::init_dmabuf_global}
|
|||
use smithay::{
|
||||
backend::{
|
||||
egl::{EGLContext, EGLDisplay},
|
||||
renderer::{gles2::Gles2Renderer, Bind, ImportEgl, Renderer, Transform, Unbind},
|
||||
renderer::{gles2::Gles2Renderer, Bind, ImportEgl, Renderer, Unbind},
|
||||
x11::{WindowBuilder, X11Backend, X11Event, X11Surface},
|
||||
SwapBuffersError,
|
||||
},
|
||||
|
@ -20,6 +20,7 @@ use smithay::{
|
|||
gbm,
|
||||
wayland_server::{protocol::wl_output, Display},
|
||||
},
|
||||
utils::Transform,
|
||||
wayland::{
|
||||
output::{Mode, PhysicalProperties},
|
||||
seat::CursorImageStatus,
|
||||
|
|
Loading…
Reference in New Issue