diff options
-rw-r--r-- | include/mupdf/fitz/geometry.h | 1 | ||||
-rw-r--r-- | source/fitz/geometry.c | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/mupdf/fitz/geometry.h b/include/mupdf/fitz/geometry.h index 20d352ef..180ae8da 100644 --- a/include/mupdf/fitz/geometry.h +++ b/include/mupdf/fitz/geometry.h @@ -561,6 +561,7 @@ fz_rect *fz_rect_from_irect(fz_rect *restrict rect, const fz_irect *restrict bbo fz_expand_rect: Expand a bbox by a given amount in all directions. */ fz_rect *fz_expand_rect(fz_rect *b, float expand); +fz_irect *fz_expand_irect(fz_irect *a, int expand); /* fz_include_point_in_rect: Expand a bbox to include a given point. diff --git a/source/fitz/geometry.c b/source/fitz/geometry.c index 688b7046..775d442a 100644 --- a/source/fitz/geometry.c +++ b/source/fitz/geometry.c @@ -532,6 +532,17 @@ fz_transform_rect(fz_rect *restrict r, const fz_matrix *restrict m) return r; } +fz_irect * +fz_expand_irect(fz_irect *a, int expand) +{ + if (fz_is_infinite_irect(a)) return a; + a->x0 -= expand; + a->y0 -= expand; + a->x1 += expand; + a->y1 += expand; + return a; +} + fz_rect * fz_expand_rect(fz_rect *a, float expand) { |