diff options
-rw-r--r-- | include/mupdf/fitz/geometry.h | 1 | ||||
-rw-r--r-- | source/fitz/geometry.c | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/mupdf/fitz/geometry.h b/include/mupdf/fitz/geometry.h index f1f1501f..20d352ef 100644 --- a/include/mupdf/fitz/geometry.h +++ b/include/mupdf/fitz/geometry.h @@ -575,6 +575,7 @@ fz_rect *fz_include_point_in_rect(fz_rect *r, const fz_point *p); Translate a bbox by a given x and y offset. Allows for overflow. */ +fz_rect *fz_translate_rect(fz_rect *a, float xoff, float yoff); fz_irect *fz_translate_irect(fz_irect *a, int xoff, int yoff); /* diff --git a/source/fitz/geometry.c b/source/fitz/geometry.c index 8bed26a1..688b7046 100644 --- a/source/fitz/geometry.c +++ b/source/fitz/geometry.c @@ -464,6 +464,18 @@ fz_union_rect(fz_rect *restrict a, const fz_rect *restrict b) return a; } +fz_rect * +fz_translate_rect(fz_rect *a, float xoff, float yoff) +{ + if (fz_is_empty_rect(a)) return a; + if (fz_is_infinite_rect(a)) return a; + a->x0 += xoff; + a->y0 += yoff; + a->x1 += xoff; + a->y1 += yoff; + return a; +} + fz_irect * fz_translate_irect(fz_irect *a, int xoff, int yoff) { |