summaryrefslogtreecommitdiffstats
path: root/libass/ass_outline.h
diff options
context:
space:
mode:
authorDr.Smile <vabnick@gmail.com>2017-09-17 03:39:11 +0300
committerDr.Smile <vabnick@gmail.com>2017-09-17 04:07:20 +0300
commitad6510b9c78f5c79f7492b608912dc5281e15e47 (patch)
tree245c655bd8f0b4c4a2884d941509c965dc8778bd /libass/ass_outline.h
parent71cf4e3b6328cdac390cdc84fa9c289224e2179d (diff)
downloadlibass-ad6510b9c78f5c79f7492b608912dc5281e15e47.tar.bz2
libass-ad6510b9c78f5c79f7492b608912dc5281e15e47.tar.xz
Consolidate bounding box operations
Diffstat (limited to 'libass/ass_outline.h')
-rw-r--r--libass/ass_outline.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/libass/ass_outline.h b/libass/ass_outline.h
index c6989f7..6be0211 100644
--- a/libass/ass_outline.h
+++ b/libass/ass_outline.h
@@ -24,6 +24,8 @@
#include <stdbool.h>
#include <stdint.h>
+#include "ass_utils.h"
+
typedef struct {
int32_t x, y;
@@ -41,6 +43,21 @@ typedef struct {
double x_min, y_min, x_max, y_max;
} ASS_DRect;
+static inline void rectangle_reset(ASS_Rect *rect)
+{
+ rect->x_min = rect->y_min = INT32_MAX;
+ rect->x_max = rect->y_max = INT32_MIN;
+}
+
+static inline void rectangle_update(ASS_Rect *rect,
+ int32_t x_min, int32_t y_min, int32_t x_max, int32_t y_max)
+{
+ rect->x_min = FFMIN(rect->x_min, x_min);
+ rect->y_min = FFMIN(rect->y_min, y_min);
+ rect->x_max = FFMAX(rect->x_max, x_max);
+ rect->y_max = FFMAX(rect->y_max, y_max);
+}
+
/*
* Outline represented with array of points and array of segments.
* Segment here is spline of order 1 (line), 2 (quadratic) or 3 (cubic).