aboutsummaryrefslogtreecommitdiff
path: root/render/matrix.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-11-30 23:58:12 +0100
committeremersion <contact@emersion.fr>2017-11-30 23:58:12 +0100
commitf4754ad1a21eaede20f6e9c5d4e0c78294119cc1 (patch)
treee42e7bf233b133420e860fae6f60c6656998386d /render/matrix.c
parent779cccf8b421b99031884f4d2886e788ac77a6eb (diff)
Fix surface transforms
Diffstat (limited to 'render/matrix.c')
-rw-r--r--render/matrix.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/render/matrix.c b/render/matrix.c
index e49d365e..8a3352e0 100644
--- a/render/matrix.c
+++ b/render/matrix.c
@@ -118,6 +118,23 @@ static const float transforms[][4] = {
},
};
+void wlr_matrix_transform(float mat[static 16],
+ enum wl_output_transform transform) {
+ memset(mat, 0, sizeof(*mat) * 16);
+
+ const float *t = transforms[transform];
+
+ // Rotation + relection
+ mat[0] = t[0];
+ mat[1] = t[1];
+ mat[4] = -t[2];
+ mat[5] = -t[3];
+
+ // Identity
+ mat[10] = 1.0f;
+ mat[15] = 1.0f;
+}
+
// Equivilent to glOrtho(0, width, 0, height, 1, -1) with the transform applied
void wlr_matrix_texture(float mat[static 16], int32_t width, int32_t height,
enum wl_output_transform transform) {