fix: PVS-Studio V550

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
Vyacheslav Ivanov
2024-08-03 23:00:10 +03:00
committed by Pugemon
parent 3621e7ce1b
commit ab28b4df70
4 changed files with 19 additions and 14 deletions
+6 -3
View File
@@ -6,6 +6,8 @@
#include <GL/glew.h>
#include <cmath>
inline constexpr uint B2D_VERTEX_SIZE = 8;
Batch2D::Batch2D(size_t capacity) : capacity(capacity), color(1.0f){
@@ -163,9 +165,10 @@ void Batch2D::rect(
float x1,y1,x2,y2,x3,y3,x4,y4;
if (angle != 0) {
float s = sin(angle);
float c = cos(angle);
constexpr float epsilon = 1e-6f; // 0.000001
if (std::fabs(angle) > epsilon) {
float s = std::sin(angle);
float c = std::cos(angle);
x1 = c * _x1 - s * _y1;
y1 = s * _x1 + c * _y1;