compositor: transform surface coordinates if a surface scaler is used
Implements wl_surface_scaler.set by setting desired
src_{x,y,width,height} and dst_{width,height} values in the
weston_buffer_viewport struct, then altering coordinates in
weston_surface_to_buffer* functions if there is a scaler set for said
surface.
diff --git a/src/compositor.h b/src/compositor.h
index f32a497..2b9bb6e 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -658,6 +658,15 @@
/* wl_surface.set_scaling_factor */
int32_t scale;
+
+ /* bool for whether wl_surface_scaler.set has been
+ * called yet (before this is called there is no
+ * cropping or scaling on the surface) */
+ int scaler_set; /* bool */
+
+ wl_fixed_t src_x, src_y;
+ wl_fixed_t src_width, src_height;
+ int32_t dst_width, dst_height;
};
struct weston_region {
@@ -851,6 +860,9 @@
struct weston_buffer_viewport buffer_viewport;
int keep_buffer; /* bool for backends to prevent early release */
+ /* wl_surface_scaler resource for this surface */
+ struct wl_resource *surface_scaler_resource;
+
/* All the pending state, that wl_surface.commit will apply. */
struct {
/* wl_surface.attach */
@@ -874,6 +886,7 @@
/* wl_surface.set_buffer_transform */
/* wl_surface.set_scaling_factor */
+ /* wl_surface_scaler.set */
struct weston_buffer_viewport buffer_viewport;
} pending;