Skip to content

Commit

Permalink
math: include cstring for memset
Browse files Browse the repository at this point in the history
 fixup name too
  • Loading branch information
vaxerski committed Jun 21, 2024
1 parent fabc30d commit 8cf2ca1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/helpers/math/Math.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "Math.hpp"
#include <unordered_map>
#include <cstring>

Hyprutils::Math::eTransform wlTransformToHyprutils(wl_output_transform t) {
switch (t) {
Expand Down Expand Up @@ -52,21 +53,21 @@ static void matrixTranslate(float mat[9], float x, float y) {
float translate[9] = {
1.0f, 0.0f, x, 0.0f, 1.0f, y, 0.0f, 0.0f, 1.0f,
};
wlr_matrix_multiply(mat, mat, translate);
matrixMultiply(mat, mat, translate);
}

static void matrixScale(float mat[9], float x, float y) {
float scale[9] = {
x, 0.0f, 0.0f, 0.0f, y, 0.0f, 0.0f, 0.0f, 1.0f,
};
wlr_matrix_multiply(mat, mat, scale);
matrixMultiply(mat, mat, scale);
}

static void matrixRotate(float mat[9], float rad) {
float rotate[9] = {
cos(rad), -sin(rad), 0.0f, sin(rad), cos(rad), 0.0f, 0.0f, 0.0f, 1.0f,
};
wlr_matrix_multiply(mat, mat, rotate);
matrixMultiply(mat, mat, rotate);
}

static std::unordered_map<eTransform, std::array<float, 9>> transforms = {
Expand Down Expand Up @@ -208,7 +209,7 @@ void projectBox(float mat[9], CBox& box, eTransform transform, float rotation, c
matrixTranslate(mat, -width / 2, -height / 2);
}

wlr_matrix_scale(mat, width, height);
matrixScale(mat, width, height);

if (transform != HYPRUTILS_TRANSFORM_NORMAL) {
matrixTranslate(mat, 0.5, 0.5);
Expand Down

0 comments on commit 8cf2ca1

Please sign in to comment.