diff options
author | emersion <contact@emersion.fr> | 2017-12-14 23:59:04 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-12-14 23:59:04 +0100 |
commit | 6b42bfad18f7bcb08ef031c699159d40ff6ac2a0 (patch) | |
tree | c8c24d5cf48c8a7487499d37da92e1bf7da419b9 /render | |
parent | b884025558e750268a06818dc63bc46716c75843 (diff) | |
parent | 23fb663ea4eaff436d9bfab7f74cdd298fac44c5 (diff) |
Merge branch 'master' into xwm-selection
Diffstat (limited to 'render')
-rw-r--r-- | render/egl.c | 2 | ||||
-rw-r--r-- | render/matrix.c | 39 |
2 files changed, 29 insertions, 12 deletions
diff --git a/render/egl.c b/render/egl.c index 22d58df2..e895df8d 100644 --- a/render/egl.c +++ b/render/egl.c @@ -141,7 +141,7 @@ error: return false; } -void wlr_egl_free(struct wlr_egl *egl) { +void wlr_egl_finish(struct wlr_egl *egl) { eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (egl->wl_display && eglUnbindWaylandDisplayWL) { eglUnbindWaylandDisplayWL(egl->display, egl->wl_display); diff --git a/render/matrix.c b/render/matrix.c index e49d365e..54dba4cc 100644 --- a/render/matrix.c +++ b/render/matrix.c @@ -86,38 +86,55 @@ void wlr_matrix_mul(const float (*x)[16], const float (*y)[16], float (*product) static const float transforms[][4] = { [WL_OUTPUT_TRANSFORM_NORMAL] = { 1.0f, 0.0f, - 0.0f, -1.0f, + 0.0f, 1.0f, }, [WL_OUTPUT_TRANSFORM_90] = { 0.0f, -1.0f, - -1.0f, 0.0f, + 1.0f, 0.0f, }, [WL_OUTPUT_TRANSFORM_180] = { -1.0f, 0.0f, - 0.0f, 1.0f, + 0.0f, -1.0f, }, [WL_OUTPUT_TRANSFORM_270] = { 0.0f, 1.0f, - 1.0f, 0.0f, + -1.0f, 0.0f, }, [WL_OUTPUT_TRANSFORM_FLIPPED] = { -1.0f, 0.0f, - 0.0f, -1.0f, + 0.0f, 1.0f, }, [WL_OUTPUT_TRANSFORM_FLIPPED_90] = { - 0.0f, 1.0f, + 0.0f, -1.0f, -1.0f, 0.0f, }, [WL_OUTPUT_TRANSFORM_FLIPPED_180] = { 1.0f, 0.0f, - 0.0f, 1.0f, + 0.0f, -1.0f, }, [WL_OUTPUT_TRANSFORM_FLIPPED_270] = { - 0.0f, -1.0f, + 0.0f, 1.0f, 1.0f, 0.0f, }, }; +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 + reflection + 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) { @@ -127,11 +144,11 @@ void wlr_matrix_texture(float mat[static 16], int32_t width, int32_t height, float x = 2.0f / width; float y = 2.0f / height; - // Rotation + relection + // Rotation + reflection mat[0] = x * t[0]; mat[1] = x * t[1]; - mat[4] = y * t[2]; - mat[5] = y * t[3]; + mat[4] = y * -t[2]; + mat[5] = y * -t[3]; // Translation mat[3] = -copysign(1.0f, mat[0] + mat[1]); |