diff options
Diffstat (limited to 'video/out/opengl/utils.h')
-rw-r--r-- | video/out/opengl/utils.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/video/out/opengl/utils.h b/video/out/opengl/utils.h index 19edfe4b24..e1b849ffab 100644 --- a/video/out/opengl/utils.h +++ b/video/out/opengl/utils.h @@ -20,6 +20,7 @@ #define MP_GL_UTILS_ #include "common.h" +#include "math.h" struct mp_log; @@ -114,6 +115,13 @@ struct mp_rect_f { float x0, y0, x1, y1; }; +// Semantic equality (fuzzy comparison) +static inline bool mp_rect_f_seq(struct mp_rect_f a, struct mp_rect_f b) +{ + return fabs(a.x0 - b.x0) < 1e-6 && fabs(a.x1 - b.x1) < 1e-6 && + fabs(a.y0 - b.y0) < 1e-6 && fabs(a.y1 - b.y1) < 1e-6; +} + static inline void gl_transform_rect(struct gl_transform t, struct mp_rect_f *r) { gl_transform_vec(t, &r->x0, &r->y0); |