diff options
author | Reza Jelveh <[email protected]> | 2024-04-15 13:39:41 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2024-04-15 01:39:41 -0400 |
commit | fb86ed6b0588dfdebfb66ce875bc63cfa0a897f6 (patch) | |
tree | 29857a1769107adc58696f08d379f608aa4e29a2 /sway/desktop/fx_renderer/matrix.c | |
parent | a5e79676c4bd22fc5902182acf0667907202a465 (diff) |
feat: 1.9 merge (#277)
Co-authored-by: William McKinnon <[email protected]>
Co-authored-by: Erik Reider <[email protected]>
Diffstat (limited to 'sway/desktop/fx_renderer/matrix.c')
-rw-r--r-- | sway/desktop/fx_renderer/matrix.c | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/sway/desktop/fx_renderer/matrix.c b/sway/desktop/fx_renderer/matrix.c deleted file mode 100644 index 9c9dabec..00000000 --- a/sway/desktop/fx_renderer/matrix.c +++ /dev/null @@ -1,70 +0,0 @@ -#include <math.h> -#include <string.h> -#include <wlr/types/wlr_output.h> - -#include "sway/desktop/fx_renderer/matrix.h" - -static const float transforms[][9] = { - [WL_OUTPUT_TRANSFORM_NORMAL] = { - 1.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 1.0f, - }, - [WL_OUTPUT_TRANSFORM_90] = { - 0.0f, 1.0f, 0.0f, - -1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, - }, - [WL_OUTPUT_TRANSFORM_180] = { - -1.0f, 0.0f, 0.0f, - 0.0f, -1.0f, 0.0f, - 0.0f, 0.0f, 1.0f, - }, - [WL_OUTPUT_TRANSFORM_270] = { - 0.0f, -1.0f, 0.0f, - 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, - }, - [WL_OUTPUT_TRANSFORM_FLIPPED] = { - -1.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 1.0f, - }, - [WL_OUTPUT_TRANSFORM_FLIPPED_90] = { - 0.0f, 1.0f, 0.0f, - 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, - }, - [WL_OUTPUT_TRANSFORM_FLIPPED_180] = { - 1.0f, 0.0f, 0.0f, - 0.0f, -1.0f, 0.0f, - 0.0f, 0.0f, 1.0f, - }, - [WL_OUTPUT_TRANSFORM_FLIPPED_270] = { - 0.0f, -1.0f, 0.0f, - -1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, - }, -}; - -void matrix_projection(float mat[static 9], int width, int height, - enum wl_output_transform transform) { - memset(mat, 0, sizeof(*mat) * 9); - - const float *t = transforms[transform]; - float x = 2.0f / width; - float y = 2.0f / height; - - // Rotation + reflection - mat[0] = x * t[0]; - mat[1] = x * t[1]; - mat[3] = y * -t[3]; - mat[4] = y * -t[4]; - - // Translation - mat[2] = -copysign(1.0f, mat[0] + mat[1]); - mat[5] = -copysign(1.0f, mat[3] + mat[4]); - - // Identity - mat[8] = 1.0f; -} |