diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-06-18 16:53:31 +0200 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2018-06-22 16:48:50 +0100 |
commit | a69f71e89bc9c325bc91fc0ec69f3ca231c83efe (patch) | |
tree | eebcd5a596133fa0519713371f552aed42487e7e /source | |
parent | 1e84b1dc23b6e57b87e6f7656dd7bd31ec7370d6 (diff) | |
download | mupdf-a69f71e89bc9c325bc91fc0ec69f3ca231c83efe.tar.xz |
Add fz_quad type.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/geometry.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/fitz/geometry.c b/source/fitz/geometry.c index 4c488669..df02eeb5 100644 --- a/source/fitz/geometry.c +++ b/source/fitz/geometry.c @@ -577,3 +577,24 @@ int fz_contains_rect(const fz_rect *a, const fz_rect *b) (a->x1 >= b->x1) && (a->y1 >= b->y1)); } + +fz_rect +fz_rect_from_quad(fz_quad q) +{ + fz_rect r; + r.x0 = MIN4(q.ll.x, q.lr.x, q.ul.x, q.ur.x); + r.y0 = MIN4(q.ll.y, q.lr.y, q.ul.y, q.ur.y); + r.x1 = MAX4(q.ll.x, q.lr.x, q.ul.x, q.ur.x); + r.y1 = MAX4(q.ll.y, q.lr.y, q.ul.y, q.ur.y); + return r; +} + +fz_quad * +fz_transform_quad(fz_quad *q, const fz_matrix *m) +{ + fz_transform_point(&q->ul, m); + fz_transform_point(&q->ur, m); + fz_transform_point(&q->ll, m); + fz_transform_point(&q->lr, m); + return q; +} |