File: transform.h

package info (click to toggle)
wl-mirror 0.18.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 688 kB
  • sloc: ansic: 4,886; xml: 2,062; sh: 284; makefile: 54
file content (54 lines) | stat: -rw-r--r-- 1,571 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef WL_MIRROR_TRANSFORM_H_
#define WL_MIRROR_TRANSFORM_H_

#include <stdbool.h>
#include <wayland-client-protocol.h>
#include <wlm/proto/linux-dmabuf-unstable-v1.h>

typedef enum {
    ROT_CW_0,
    ROT_CW_90,
    ROT_CW_180,
    ROT_CW_270,

    ROT_NORMAL = ROT_CW_0,
    ROT_CCW_0 = ROT_CW_0,
    ROT_CCW_90 = ROT_CW_270,
    ROT_CCW_180 = ROT_CW_180,
    ROT_CCW_270 = ROT_CW_90
} rotation_t;

typedef struct {
    rotation_t rotation;
    bool flip_x;
    bool flip_y;
} transform_t;

typedef struct {
    int32_t x;
    int32_t y;
    int32_t width;
    int32_t height;
} region_t;

typedef struct {
    float data[3][3];
} mat3_t;

void wlm_util_mat3_identity(mat3_t * mat);
void wlm_util_mat3_transpose(mat3_t * mat);
void wlm_util_mat3_mul(const mat3_t * mul, mat3_t * dest);

void wlm_util_mat3_apply_transform(mat3_t * mat, transform_t transform);
void wlm_util_mat3_apply_region_transform(mat3_t * mat, const region_t * region, const region_t * output);
void wlm_util_mat3_apply_output_transform(mat3_t * mat, enum wl_output_transform transform);
void wlm_util_mat3_apply_invert_y(mat3_t * mat, bool invert_y);

void wlm_util_viewport_apply_transform(uint32_t * width, uint32_t * height, transform_t transform);
void wlm_util_viewport_apply_output_transform(uint32_t * width, uint32_t * height, enum wl_output_transform transform);

bool wlm_util_region_contains(const region_t * region, const region_t * output);
void wlm_util_region_scale(region_t * region, double scale);
void wlm_util_region_clamp(region_t * region, const region_t * output);

#endif