Damage tracking for transformed outputs

This commit is contained in:
emersion 2018-01-26 22:11:09 +01:00
parent a98ece68d3
commit ece2c1e4e2
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
12 changed files with 185 additions and 154 deletions

View file

@ -7,7 +7,7 @@
/**
* Damage tracking requires to keep track of previous frames' damage. To allow
* damage tracking to work with triple buffering, an history of two frames is
* damage tracking to work with triple buffering, a history of two frames is
* required.
*/
#define ROOTS_OUTPUT_PREVIOUS_DAMAGE_LEN 2
@ -22,7 +22,7 @@ struct roots_output {
struct roots_view *fullscreen_view;
struct timespec last_frame;
pixman_region32_t damage;
pixman_region32_t damage; // in ouput-local coordinates
bool frame_pending;
// circular queue for previous damage

View file

@ -2,6 +2,7 @@
#define WLR_TYPES_WLR_BOX_H
#include <stdbool.h>
#include <wayland-server.h>
struct wlr_box {
int x, y;
@ -18,8 +19,11 @@ bool wlr_box_contains_point(const struct wlr_box *box, double x, double y);
bool wlr_box_empty(const struct wlr_box *box);
enum wl_output_transform;
/**
* Transforms a box inside a `width` x `height` box.
*/
void wlr_box_transform(const struct wlr_box *box,
enum wl_output_transform transform, struct wlr_box *dest);
enum wl_output_transform transform, int width, int height,
struct wlr_box *dest);
#endif

View file

@ -61,7 +61,8 @@ struct wlr_output {
enum wl_output_transform transform;
bool needs_swap;
pixman_region32_t damage; // damage for cursors and fullscreen surface
// damage for cursors and fullscreen surface, in output-local coordinates
pixman_region32_t damage;
float transform_matrix[16];
struct {

View file

@ -2,6 +2,7 @@
#define WLR_UTIL_REGION_H
#include <pixman.h>
#include <wayland-server.h>
/**
* Scales a region, ie. multiplies all its coordinates by `scale`.
@ -12,4 +13,10 @@
void wlr_region_scale(pixman_region32_t *dst, pixman_region32_t *src,
float scale);
/**
* Applies a transform to a region inside a box of size `width` x `height`.
*/
void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src,
enum wl_output_transform transform, int width, int height);
#endif