diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2013-01-30 13:57:45 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2013-01-30 14:13:01 +0100 |
commit | 01e2ccf6ade55cc20e83b80bad81fef6627c9a05 (patch) | |
tree | cf3d40a3ed540ae9cb412cb7473fa469d8adebb7 | |
parent | 594c64f744862b993bcad12e05217f3d43e7d547 (diff) | |
download | mupdf-01e2ccf6ade55cc20e83b80bad81fef6627c9a05.tar.xz |
Rename fz_rect_covering_rect to fz_irect_from_rect.
It used to be called fz_bbox_covering_rect. It does exact rounding outwards
of a rect, so that the resulting irect will always cover the entire
area of the input rect.
Use fz_round_rect for fuzzy rounding where near-integer values are
rounded inwards.
-rw-r--r-- | draw/draw_affine.c | 2 | ||||
-rw-r--r-- | draw/draw_device.c | 24 | ||||
-rw-r--r-- | fitz/base_geometry.c | 2 | ||||
-rw-r--r-- | fitz/fitz.h | 6 | ||||
-rw-r--r-- | fitz/res_font.c | 2 |
5 files changed, 18 insertions, 18 deletions
diff --git a/draw/draw_affine.c b/draw/draw_affine.c index a824c874..e74bef2b 100644 --- a/draw/draw_affine.c +++ b/draw/draw_affine.c @@ -629,7 +629,7 @@ fz_paint_image_imp(fz_pixmap *dst, fz_irect scissor, fz_pixmap *shape, fz_pixmap dolerp = 0; } - bbox = fz_rect_covering_rect(fz_transform_rect(ctm, fz_unit_rect)); + bbox = fz_irect_from_rect(fz_transform_rect(ctm, fz_unit_rect)); bbox = fz_intersect_irect(bbox, scissor); x = bbox.x0; diff --git a/draw/draw_device.c b/draw/draw_device.c index 0e2697e4..ebca7fdc 100644 --- a/draw/draw_device.c +++ b/draw/draw_device.c @@ -367,7 +367,7 @@ fz_draw_clip_path(fz_device *devp, fz_path *path, fz_rect rect, int even_odd, fz bbox = fz_bound_gel(dev->gel); bbox = fz_intersect_irect(bbox, state->scissor); - bbox = fz_intersect_irect(bbox, fz_rect_covering_rect(rect)); + bbox = fz_intersect_irect(bbox, fz_irect_from_rect(rect)); if (fz_is_empty_rect(bbox) || fz_is_rect_gel(dev->gel)) { @@ -432,7 +432,7 @@ fz_draw_clip_stroke_path(fz_device *devp, fz_path *path, fz_rect rect, fz_stroke bbox = fz_bound_gel(dev->gel); bbox = fz_intersect_irect(bbox, state->scissor); - bbox = fz_intersect_irect(bbox, fz_rect_covering_rect(rect)); + bbox = fz_intersect_irect(bbox, fz_irect_from_rect(rect)); fz_try(ctx) { @@ -666,7 +666,7 @@ fz_draw_clip_text(fz_device *devp, fz_text *text, fz_matrix ctm, int accumulate) if (accumulate == 0) { /* make the mask the exact size needed */ - bbox = fz_rect_covering_rect(fz_bound_text(dev->ctx, text, ctm)); + bbox = fz_irect_from_rect(fz_bound_text(dev->ctx, text, ctm)); bbox = fz_intersect_irect(bbox, state->scissor); } else @@ -791,7 +791,7 @@ fz_draw_clip_stroke_text(fz_device *devp, fz_text *text, fz_stroke_state *stroke fz_colorspace *model = state->dest->colorspace; /* make the mask the exact size needed */ - bbox = fz_rect_covering_rect(fz_bound_text(dev->ctx, text, ctm)); + bbox = fz_irect_from_rect(fz_bound_text(dev->ctx, text, ctm)); bbox = fz_intersect_irect(bbox, state->scissor); fz_try(ctx) @@ -902,7 +902,7 @@ fz_draw_fill_shade(fz_device *devp, fz_shade *shade, fz_matrix ctm, float alpha) bounds = fz_bound_shade(dev->ctx, shade, ctm); scissor = state->scissor; - bbox = fz_intersect_irect(fz_rect_covering_rect(bounds), scissor); + bbox = fz_intersect_irect(fz_irect_from_rect(bounds), scissor); if (fz_is_empty_rect(bbox)) return; @@ -1249,9 +1249,9 @@ fz_draw_clip_image_mask(fz_device *devp, fz_image *image, fz_rect rect, fz_matri dump_spaces(dev->top-1, "Clip (image mask) begin\n"); #endif - bbox = fz_rect_covering_rect(fz_transform_rect(ctm, fz_unit_rect)); + bbox = fz_irect_from_rect(fz_transform_rect(ctm, fz_unit_rect)); bbox = fz_intersect_irect(bbox, state->scissor); - bbox = fz_intersect_irect(bbox, fz_rect_covering_rect(rect)); + bbox = fz_intersect_irect(bbox, fz_irect_from_rect(rect)); dx = sqrtf(ctm.a * ctm.a + ctm.b * ctm.b); dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d); @@ -1365,7 +1365,7 @@ fz_draw_begin_mask(fz_device *devp, fz_rect rect, int luminosity, fz_colorspace fz_pixmap *shape = state->shape; fz_context *ctx = dev->ctx; - bbox = fz_rect_covering_rect(rect); + bbox = fz_irect_from_rect(rect); bbox = fz_intersect_irect(bbox, state->scissor); fz_try(ctx) @@ -1478,7 +1478,7 @@ fz_draw_begin_group(fz_device *devp, fz_rect rect, int isolated, int knockout, i fz_knockout_begin(dev); state = push_stack(dev); - bbox = fz_rect_covering_rect(rect); + bbox = fz_irect_from_rect(rect); bbox = fz_intersect_irect(bbox, state->scissor); fz_try(ctx) @@ -1603,7 +1603,7 @@ fz_draw_begin_tile(fz_device *devp, fz_rect area, fz_rect view, float xstep, flo fz_knockout_begin(dev); state = push_stack(dev); - bbox = fz_rect_covering_rect(fz_transform_rect(ctm, view)); + bbox = fz_irect_from_rect(fz_transform_rect(ctm, view)); /* We should never have a bbox that entirely covers our destination. * If we do, then the check for only 1 tile being visible above has * failed. Actually, this *can* fail due to the round_rect, at extreme @@ -1624,7 +1624,7 @@ fz_draw_begin_tile(fz_device *devp, fz_rect area, fz_rect view, float xstep, flo state[1].blendmode |= FZ_BLEND_ISOLATED; state[1].xstep = xstep; state[1].ystep = ystep; - state[1].area = fz_rect_covering_rect(area); + state[1].area = fz_irect_from_rect(area); state[1].ctm = ctm; #ifdef DUMP_GROUP_BLENDS dump_spaces(dev->top-1, "Tile begin\n"); @@ -1668,7 +1668,7 @@ fz_draw_end_tile(fz_device *devp) scissor_tmp = fz_rect_from_irect(state[0].scissor); scissor_tmp = fz_expand_rect(scissor_tmp, 1); scissor_tmp = fz_transform_rect(fz_invert_matrix(ctm), scissor_tmp); - scissor = fz_rect_covering_rect(scissor_tmp); + scissor = fz_irect_from_rect(scissor_tmp); area = fz_intersect_irect(area, scissor); x0 = floorf(area.x0 / xstep); diff --git a/fitz/base_geometry.c b/fitz/base_geometry.c index 317c8df1..54380c84 100644 --- a/fitz/base_geometry.c +++ b/fitz/base_geometry.c @@ -193,7 +193,7 @@ const fz_irect fz_empty_irect = { 0, 0, 0, 0 }; const fz_irect fz_unit_irect = { 0, 0, 1, 1 }; fz_irect -fz_rect_covering_rect(fz_rect a) +fz_irect_from_rect(fz_rect a) { fz_irect b; diff --git a/fitz/fitz.h b/fitz/fitz.h index 0e025e44..f3fd7458 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -942,7 +942,7 @@ fz_irect fz_intersect_irect(fz_irect a, fz_irect b); fz_rect fz_union_rect(fz_rect a, fz_rect b); /* - fz_rect_covering_rect: Convert a rect into the minimal bounding box + fz_irect_from_rect: Convert a rect into the minimal bounding box that covers the rectangle. Coordinates in a bounding box are integers, so rounding of the @@ -953,7 +953,7 @@ fz_rect fz_union_rect(fz_rect a, fz_rect b); Does not throw exceptions. */ -fz_irect fz_rect_covering_rect(fz_rect rect); +fz_irect fz_irect_from_rect(fz_rect rect); /* fz_round_rect: Round rectangle coordinates. @@ -963,7 +963,7 @@ fz_irect fz_rect_covering_rect(fz_rect rect); upwards and left while the bottom right corner is rounded downwards and to the right. - This differs from fz_rect_covering_rect, in that fz_rect_covering_rect + This differs from fz_irect_from_rect, in that fz_rect_covering_rect slavishly follows the numbers (i.e any slight over/under calculations can cause whole extra pixels to be added). fz_round_rect allows for a small amount of rounding error when calculating diff --git a/fitz/res_font.c b/fitz/res_font.c index 56481962..47ec7c37 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -923,7 +923,7 @@ fz_render_t3_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, fz_co bounds = fz_bound_glyph(ctx, font, gid, trm); bounds = fz_expand_rect(bounds, 1); - bbox = fz_rect_covering_rect(bounds); + bbox = fz_irect_from_rect(bounds); bbox = fz_intersect_irect(bbox, scissor); glyph = fz_new_pixmap_with_bbox(ctx, model ? model : fz_device_gray, bbox); |