diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2013-02-06 15:14:20 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-02-06 19:24:15 +0000 |
commit | 0bd405c16618e1b0cdaba67fe61509cd113ba653 (patch) | |
tree | 4434bd3d873418feaa5d96d7a6f4539ec3b57fb4 | |
parent | b951f35ea59e27a21a63b84ec1506974ceab27a0 (diff) | |
download | mupdf-0bd405c16618e1b0cdaba67fe61509cd113ba653.tar.xz |
Rename bbox to irect.
-rw-r--r-- | android/jni/mupdf.c | 8 | ||||
-rw-r--r-- | apps/mudraw.c | 4 | ||||
-rw-r--r-- | apps/pdfapp.c | 12 | ||||
-rw-r--r-- | doc/example.c | 2 | ||||
-rw-r--r-- | draw/draw_affine.c | 12 | ||||
-rw-r--r-- | draw/draw_blend.c | 6 | ||||
-rw-r--r-- | draw/draw_device.c | 130 | ||||
-rw-r--r-- | draw/draw_edge.c | 22 | ||||
-rw-r--r-- | draw/draw_glyph.c | 6 | ||||
-rw-r--r-- | draw/draw_mesh.c | 6 | ||||
-rw-r--r-- | draw/draw_paint.c | 20 | ||||
-rw-r--r-- | draw/draw_scale.c | 4 | ||||
-rw-r--r-- | draw/draw_simple_scale.c | 4 | ||||
-rw-r--r-- | fitz/base_geometry.c | 40 | ||||
-rw-r--r-- | fitz/fitz-internal.h | 28 | ||||
-rw-r--r-- | fitz/fitz.h | 46 | ||||
-rw-r--r-- | fitz/image_save.c | 2 | ||||
-rw-r--r-- | fitz/res_font.c | 8 | ||||
-rw-r--r-- | fitz/res_pixmap.c | 32 | ||||
-rw-r--r-- | pdf/pdf_colorspace.c | 2 |
20 files changed, 197 insertions, 197 deletions
diff --git a/android/jni/mupdf.c b/android/jni/mupdf.c index 1ff87c7a..f665c9c2 100644 --- a/android/jni/mupdf.c +++ b/android/jni/mupdf.c @@ -455,7 +455,7 @@ JNI_FN(MuPDFCore_gotoPageInternal)(JNIEnv *env, jobject thiz, int page) int furthest_dist = -1; float zoom; fz_matrix ctm; - fz_bbox bbox; + fz_irect bbox; page_cache *pc; globals *glo = get_globals(env, thiz); fz_context *ctx = glo->ctx; @@ -567,7 +567,7 @@ JNI_FN(MuPDFCore_drawPage)(JNIEnv *env, jobject thiz, jobject bitmap, fz_device *dev = NULL; float zoom; fz_matrix ctm; - fz_bbox bbox; + fz_irect bbox; fz_rect rect; fz_pixmap *pix = NULL; float xscale, yscale; @@ -719,7 +719,7 @@ JNI_FN(MuPDFCore_updatePageInternal)(JNIEnv *env, jobject thiz, jobject bitmap, fz_device *dev = NULL; float zoom; fz_matrix ctm; - fz_bbox bbox; + fz_irect bbox; fz_rect rect; fz_pixmap *pix = NULL; float xscale, yscale; @@ -824,7 +824,7 @@ JNI_FN(MuPDFCore_updatePageInternal)(JNIEnv *env, jobject thiz, jobject bitmap, LOGI("Start partial update"); for (crect = hq ? pc->hq_changed_rects : pc->changed_rects; crect; crect = crect->next) { - fz_bbox abox; + fz_irect abox; fz_rect arect = fz_transform_rect(ctm, crect->rect); arect = fz_intersect_rect(arect, rect); abox = fz_round_rect(arect); diff --git a/apps/mudraw.c b/apps/mudraw.c index 668dad41..a1cc4eaf 100644 --- a/apps/mudraw.c +++ b/apps/mudraw.c @@ -406,7 +406,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) float zoom; fz_matrix ctm; fz_rect bounds, tbounds; - fz_bbox ibounds; + fz_irect ibounds; fz_pixmap *pix = NULL; int w, h; @@ -469,7 +469,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) fz_transform_rect(&tbounds, &ctm); } fz_round_rect(&ibounds, &tbounds); - fz_rect_from_bbox(&tbounds, &ibounds); + fz_rect_from_irect(&tbounds, &ibounds); /* TODO: banded rendering and multi-page ppm */ diff --git a/apps/pdfapp.c b/apps/pdfapp.c index dab2a7b9..6a0e8054 100644 --- a/apps/pdfapp.c +++ b/apps/pdfapp.c @@ -100,7 +100,7 @@ void pdfapp_init(fz_context *ctx, pdfapp_t *app) void pdfapp_invert(pdfapp_t *app, const fz_rect *rect) { - fz_bbox b; + fz_irect b; fz_invert_pixmap_rect(app->image, fz_round_rect(&b, rect)); } @@ -566,9 +566,9 @@ static void pdfapp_updatepage(pdfapp_t *app) while ((annot = fz_poll_changed_annot(idoc, app->page)) != NULL) { fz_rect bounds; - fz_bbox ibounds; + fz_irect ibounds; fz_transform_rect(fz_bound_annot(app->doc, annot, &bounds), &ctm); - fz_rect_from_bbox(&bounds, fz_round_rect(&ibounds, &bounds)); + fz_rect_from_irect(&bounds, fz_round_rect(&ibounds, &bounds)); fz_clear_pixmap_rect_with_value(app->ctx, app->image, 255, &ibounds); idev = fz_new_draw_device_with_bbox(app->ctx, app->image, &ibounds); @@ -592,7 +592,7 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai fz_colorspace *colorspace; fz_matrix ctm; fz_rect bounds; - fz_bbox ibounds; + fz_irect ibounds; fz_cookie cookie = { 0 }; if (!app->nowaitcursor) @@ -651,7 +651,7 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai pdfapp_viewctm(&ctm, app); bounds = app->page_bbox; fz_round_rect(&ibounds, fz_transform_rect(&bounds, &ctm)); - fz_rect_from_bbox(&bounds, &ibounds); + fz_rect_from_irect(&bounds, &ibounds); /* Draw */ if (app->image) @@ -1341,7 +1341,7 @@ void pdfapp_onkey(pdfapp_t *app, int c) void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int state) { fz_context *ctx = app->ctx; - fz_bbox rect; + fz_irect rect; fz_link *link; fz_matrix ctm; fz_point p; diff --git a/doc/example.c b/doc/example.c index ef2c658f..d1e4798f 100644 --- a/doc/example.c +++ b/doc/example.c @@ -50,7 +50,7 @@ render(char *filename, int pagenumber, int zoom, int rotation) // space has the origin at the top left corner and the x axis // extends to the right and the y axis extends down. - fz_bbox bbox = fz_round_rect(bounds); + fz_irect bbox = fz_round_rect(bounds); fz_pixmap *pix = fz_new_pixmap_with_bbox(ctx, fz_device_rgb, bbox); fz_clear_pixmap_with_value(ctx, pix, 0xff); diff --git a/draw/draw_affine.c b/draw/draw_affine.c index 8943214f..32e890f8 100644 --- a/draw/draw_affine.c +++ b/draw/draw_affine.c @@ -597,13 +597,13 @@ fz_gridfit_matrix(fz_matrix *m) /* Draw an image with an affine transform on destination */ static void -fz_paint_image_imp(fz_pixmap *dst, const fz_bbox *scissor, fz_pixmap *shape, fz_pixmap *img, const fz_matrix *ctm, byte *color, int alpha) +fz_paint_image_imp(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz_pixmap *img, const fz_matrix *ctm, byte *color, int alpha) { byte *dp, *sp, *hp; int u, v, fa, fb, fc, fd; int x, y, w, h; int sw, sh, n, hw; - fz_bbox bbox; + fz_irect bbox; int dolerp; void (*paintfn)(byte *dp, byte *sp, int sw, int sh, int u, int v, int fa, int fb, int w, int n, int alpha, byte *color, byte *hp); fz_matrix local_ctm = *ctm; @@ -631,8 +631,8 @@ fz_paint_image_imp(fz_pixmap *dst, const fz_bbox *scissor, fz_pixmap *shape, fz_ } rect = fz_unit_rect; - fz_bbox_from_rect(&bbox, fz_transform_rect(&rect, &local_ctm)); - fz_intersect_bbox(&bbox, scissor); + fz_irect_from_rect(&bbox, fz_transform_rect(&rect, &local_ctm)); + fz_intersect_irect(&bbox, scissor); x = bbox.x0; if (shape && shape->x > x) @@ -731,14 +731,14 @@ fz_paint_image_imp(fz_pixmap *dst, const fz_bbox *scissor, fz_pixmap *shape, fz_ } void -fz_paint_image_with_color(fz_pixmap *dst, const fz_bbox *scissor, fz_pixmap *shape, fz_pixmap *img, const fz_matrix *ctm, byte *color) +fz_paint_image_with_color(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz_pixmap *img, const fz_matrix *ctm, byte *color) { assert(img->n == 1); fz_paint_image_imp(dst, scissor, shape, img, ctm, color, 255); } void -fz_paint_image(fz_pixmap *dst, const fz_bbox *scissor, fz_pixmap *shape, fz_pixmap *img, const fz_matrix *ctm, int alpha) +fz_paint_image(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz_pixmap *img, const fz_matrix *ctm, int alpha) { assert(dst->n == img->n || (dst->n == 4 && img->n == 2)); fz_paint_image_imp(dst, scissor, shape, img, ctm, NULL, alpha); diff --git a/draw/draw_blend.c b/draw/draw_blend.c index 1bbf1dd5..c3d9bdff 100644 --- a/draw/draw_blend.c +++ b/draw/draw_blend.c @@ -574,8 +574,8 @@ void fz_blend_pixmap(fz_pixmap *dst, fz_pixmap *src, int alpha, int blendmode, int isolated, fz_pixmap *shape) { unsigned char *sp, *dp; - fz_bbox bbox; - fz_bbox bbox2; + fz_irect bbox; + fz_irect bbox2; int x, y, w, h, n; /* TODO: fix this hack! */ @@ -592,7 +592,7 @@ fz_blend_pixmap(fz_pixmap *dst, fz_pixmap *src, int alpha, int blendmode, int is fz_pixmap_bbox_no_ctx(dst, &bbox); fz_pixmap_bbox_no_ctx(src, &bbox2); - fz_intersect_bbox(&bbox, &bbox2); + fz_intersect_irect(&bbox, &bbox2); x = bbox.x0; y = bbox.y0; diff --git a/draw/draw_device.c b/draw/draw_device.c index 79c3d02a..0c4ca2b2 100644 --- a/draw/draw_device.c +++ b/draw/draw_device.c @@ -22,7 +22,7 @@ enum { typedef struct fz_draw_state_s fz_draw_state; struct fz_draw_state_s { - fz_bbox scissor; + fz_irect scissor; fz_pixmap *dest; fz_pixmap *mask; fz_pixmap *shape; @@ -31,7 +31,7 @@ struct fz_draw_state_s { float alpha; fz_matrix ctm; float xstep, ystep; - fz_bbox area; + fz_irect area; }; struct fz_draw_device_s @@ -127,7 +127,7 @@ static fz_draw_state * fz_knockout_begin(fz_draw_device *dev) { fz_context *ctx = dev->ctx; - fz_bbox bbox; + fz_irect bbox; fz_pixmap *dest, *shape; fz_draw_state *state = &dev->stack[dev->top]; int isolated = state->blendmode & FZ_BLEND_ISOLATED; @@ -138,7 +138,7 @@ fz_knockout_begin(fz_draw_device *dev) state = push_stack(dev); fz_pixmap_bbox(dev->ctx, state->dest, &bbox); - fz_intersect_bbox(&bbox, &state->scissor); + fz_intersect_irect(&bbox, &state->scissor); dest = fz_new_pixmap_with_bbox(dev->ctx, state->dest->colorspace, &bbox); if (isolated) @@ -246,7 +246,7 @@ fz_draw_fill_path(fz_device *devp, fz_path *path, int even_odd, const fz_matrix float flatness = 0.3f / expansion; unsigned char colorbv[FZ_MAX_COLORS + 1]; float colorfv[FZ_MAX_COLORS]; - fz_bbox bbox; + fz_irect bbox; int i; fz_draw_state *state = &dev->stack[dev->top]; fz_colorspace *model = state->dest->colorspace; @@ -258,9 +258,9 @@ fz_draw_fill_path(fz_device *devp, fz_path *path, int even_odd, const fz_matrix fz_flatten_fill_path(dev->gel, path, ctm, flatness); fz_sort_gel(dev->gel); - fz_intersect_bbox(fz_bound_gel(dev->gel, &bbox), &state->scissor); + fz_intersect_irect(fz_bound_gel(dev->gel, &bbox), &state->scissor); - if (fz_is_empty_bbox(&bbox)) + if (fz_is_empty_irect(&bbox)) return; if (state->blendmode & FZ_BLEND_KNOCKOUT) @@ -296,7 +296,7 @@ fz_draw_stroke_path(fz_device *devp, fz_path *path, fz_stroke_state *stroke, con float linewidth = stroke->linewidth; unsigned char colorbv[FZ_MAX_COLORS + 1]; float colorfv[FZ_MAX_COLORS]; - fz_bbox bbox; + fz_irect bbox; int i; fz_draw_state *state = &dev->stack[dev->top]; fz_colorspace *model = state->dest->colorspace; @@ -314,9 +314,9 @@ fz_draw_stroke_path(fz_device *devp, fz_path *path, fz_stroke_state *stroke, con fz_flatten_stroke_path(dev->gel, path, stroke, ctm, flatness, linewidth); fz_sort_gel(dev->gel); - fz_intersect_bbox(fz_bound_gel(dev->gel, &bbox), &state->scissor); + fz_intersect_irect(fz_bound_gel(dev->gel, &bbox), &state->scissor); - if (fz_is_empty_bbox(&bbox)) + if (fz_is_empty_irect(&bbox)) return; if (state->blendmode & FZ_BLEND_KNOCKOUT) @@ -351,7 +351,7 @@ fz_draw_clip_path(fz_device *devp, fz_path *path, const fz_rect *rect, int even_ fz_draw_device *dev = devp->user; float expansion = fz_matrix_expansion(ctm); float flatness = 0.3f / expansion; - fz_bbox bbox; + fz_irect bbox; fz_draw_state *state = &dev->stack[dev->top]; fz_colorspace *model; fz_context *ctx = dev->ctx; @@ -363,14 +363,14 @@ fz_draw_clip_path(fz_device *devp, fz_path *path, const fz_rect *rect, int even_ state = push_stack(dev); model = state->dest->colorspace; - fz_intersect_bbox(fz_bound_gel(dev->gel, &bbox), &state->scissor); + fz_intersect_irect(fz_bound_gel(dev->gel, &bbox), &state->scissor); if (rect) { - fz_bbox bbox2; - fz_intersect_bbox(&bbox, fz_bbox_from_rect(&bbox2, rect)); + fz_irect bbox2; + fz_intersect_irect(&bbox, fz_irect_from_rect(&bbox2, rect)); } - if (fz_is_empty_bbox(&bbox) || fz_is_rect_gel(dev->gel)) + if (fz_is_empty_irect(&bbox) || fz_is_rect_gel(dev->gel)) { state[1].scissor = bbox; state[1].mask = NULL; @@ -413,7 +413,7 @@ fz_draw_clip_stroke_path(fz_device *devp, fz_path *path, const fz_rect *rect, fz float expansion = fz_matrix_expansion(ctm); float flatness = 0.3f / expansion; float linewidth = stroke->linewidth; - fz_bbox bbox; + fz_irect bbox; fz_draw_state *state = &dev->stack[dev->top]; fz_colorspace *model; fz_context *ctx = dev->ctx; @@ -431,11 +431,11 @@ fz_draw_clip_stroke_path(fz_device *devp, fz_path *path, const fz_rect *rect, fz state = push_stack(dev); model = state->dest->colorspace; - fz_intersect_bbox(fz_bound_gel(dev->gel, &bbox), &state->scissor); + fz_intersect_irect(fz_bound_gel(dev->gel, &bbox), &state->scissor); if (rect) { - fz_bbox bbox2; - fz_intersect_bbox(&bbox, fz_bbox_from_rect(&bbox2, rect)); + fz_irect bbox2; + fz_intersect_irect(&bbox, fz_irect_from_rect(&bbox2, rect)); } fz_try(ctx) @@ -450,7 +450,7 @@ fz_draw_clip_stroke_path(fz_device *devp, fz_path *path, const fz_rect *rect, fz fz_clear_pixmap(dev->ctx, state[1].shape); } - if (!fz_is_empty_bbox(&bbox)) + if (!fz_is_empty_irect(&bbox)) fz_scan_convert(dev->gel, 0, &bbox, state[1].mask, NULL); state[1].blendmode |= FZ_BLEND_ISOLATED; @@ -467,15 +467,15 @@ fz_draw_clip_stroke_path(fz_device *devp, fz_path *path, const fz_rect *rect, fz static void draw_glyph(unsigned char *colorbv, fz_pixmap *dst, fz_pixmap *msk, - int xorig, int yorig, const fz_bbox *scissor) + int xorig, int yorig, const fz_irect *scissor) { unsigned char *dp, *mp; - fz_bbox bbox; + fz_irect bbox; int x, y, w, h; fz_pixmap_bbox_no_ctx(msk, &bbox); - fz_translate_bbox(&bbox, xorig, yorig); - fz_intersect_bbox(&bbox, scissor); /* scissor < dst */ + fz_translate_irect(&bbox, xorig, yorig); + fz_intersect_irect(&bbox, scissor); /* scissor < dst */ x = bbox.x0; y = bbox.y0; w = bbox.x1 - bbox.x0; @@ -510,7 +510,7 @@ fz_draw_fill_text(fz_device *devp, fz_text *text, const fz_matrix *ctm, int i, x, y, gid; fz_draw_state *state = &dev->stack[dev->top]; fz_colorspace *model = state->dest->colorspace; - fz_bbox scissor = state->scissor; + fz_irect scissor = state->scissor; if (state->blendmode & FZ_BLEND_KNOCKOUT) state = fz_knockout_begin(dev); @@ -590,7 +590,7 @@ fz_draw_stroke_text(fz_device *devp, fz_text *text, fz_stroke_state *stroke, int i, x, y, gid; fz_draw_state *state = &dev->stack[dev->top]; fz_colorspace *model = state->dest->colorspace; - fz_bbox scissor = state->scissor; + fz_irect scissor = state->scissor; if (state->blendmode & FZ_BLEND_KNOCKOUT) state = fz_knockout_begin(dev); @@ -653,7 +653,7 @@ fz_draw_clip_text(fz_device *devp, fz_text *text, const fz_matrix *ctm, int accu { fz_draw_device *dev = devp->user; fz_context *ctx = dev->ctx; - fz_bbox bbox; + fz_irect bbox; fz_pixmap *mask, *dest, *shape; fz_matrix tm, trm, trunc_trm; fz_pixmap *glyph; @@ -673,8 +673,8 @@ fz_draw_clip_text(fz_device *devp, fz_text *text, const fz_matrix *ctm, int accu /* make the mask the exact size needed */ fz_rect rect; - fz_bbox_from_rect(&bbox, fz_bound_text(dev->ctx, text, ctm, &rect)); - fz_intersect_bbox(&bbox, &state->scissor); + fz_irect_from_rect(&bbox, fz_bound_text(dev->ctx, text, ctm, &rect)); + fz_intersect_irect(&bbox, &state->scissor); } else { @@ -713,7 +713,7 @@ fz_draw_clip_text(fz_device *devp, fz_text *text, const fz_matrix *ctm, int accu dev->top--; } - if (!fz_is_empty_bbox(&bbox) && mask) + if (!fz_is_empty_irect(&bbox) && mask) { tm = text->trm; @@ -789,7 +789,7 @@ fz_draw_clip_stroke_text(fz_device *devp, fz_text *text, fz_stroke_state *stroke { fz_draw_device *dev = devp->user; fz_context *ctx = dev->ctx; - fz_bbox bbox; + fz_irect bbox; fz_pixmap *mask, *dest, *shape; fz_matrix tm, trm, trunc_trm; fz_pixmap *glyph; @@ -799,8 +799,8 @@ fz_draw_clip_stroke_text(fz_device *devp, fz_text *text, fz_stroke_state *stroke fz_rect rect; /* make the mask the exact size needed */ - fz_bbox_from_rect(&bbox, fz_bound_text(dev->ctx, text, ctm, &rect)); - fz_intersect_bbox(&bbox, &state->scissor); + fz_irect_from_rect(&bbox, fz_bound_text(dev->ctx, text, ctm, &rect)); + fz_intersect_irect(&bbox, &state->scissor); fz_try(ctx) { @@ -822,7 +822,7 @@ fz_draw_clip_stroke_text(fz_device *devp, fz_text *text, fz_stroke_state *stroke dump_spaces(dev->top-1, "Clip (stroke text) begin\n"); #endif - if (!fz_is_empty_bbox(&bbox)) + if (!fz_is_empty_irect(&bbox)) { tm = text->trm; @@ -901,7 +901,7 @@ fz_draw_fill_shade(fz_device *devp, fz_shade *shade, const fz_matrix *ctm, float { fz_draw_device *dev = devp->user; fz_rect bounds; - fz_bbox bbox, scissor; + fz_irect bbox, scissor; fz_pixmap *dest, *shape; float colorfv[FZ_MAX_COLORS]; unsigned char colorbv[FZ_MAX_COLORS + 1]; @@ -910,9 +910,9 @@ fz_draw_fill_shade(fz_device *devp, fz_shade *shade, const fz_matrix *ctm, float fz_bound_shade(dev->ctx, shade, ctm, &bounds); scissor = state->scissor; - fz_intersect_bbox(fz_bbox_from_rect(&bbox, &bounds), &scissor); + fz_intersect_irect(fz_irect_from_rect(&bbox, &bounds), &scissor); - if (fz_is_empty_bbox(&bbox)) + if (fz_is_empty_irect(&bbox)) return; if (!model) @@ -990,7 +990,7 @@ fz_draw_fill_shade(fz_device *devp, fz_shade *shade, const fz_matrix *ctm, float } static fz_pixmap * -fz_transform_pixmap(fz_draw_device *dev, fz_pixmap *image, fz_matrix *ctm, int x, int y, int dx, int dy, int gridfit, const fz_bbox *clip) +fz_transform_pixmap(fz_draw_device *dev, fz_pixmap *image, fz_matrix *ctm, int x, int y, int dx, int dy, int gridfit, const fz_irect *clip) { fz_pixmap *scaled; fz_context *ctx = dev->ctx; @@ -1015,7 +1015,7 @@ fz_transform_pixmap(fz_draw_device *dev, fz_pixmap *image, fz_matrix *ctm, int x { /* Other orthogonal flip/rotation cases */ fz_matrix m = *ctm; - fz_bbox rclip; + fz_irect rclip; if (gridfit) fz_gridfit_matrix(&m); if (clip) @@ -1058,10 +1058,10 @@ fz_draw_fill_image(fz_device *devp, fz_image *image, const fz_matrix *ctm, float fz_context *ctx = dev->ctx; fz_draw_state *state = &dev->stack[dev->top]; fz_colorspace *model = state->dest->colorspace; - fz_bbox clip; + fz_irect clip; fz_matrix local_ctm = *ctm; - fz_intersect_bbox(fz_pixmap_bbox(ctx, state->dest, &clip), &state->scissor); + fz_intersect_irect(fz_pixmap_bbox(ctx, state->dest, &clip), &state->scissor); fz_var(scaled); @@ -1095,7 +1095,7 @@ fz_draw_fill_image(fz_device *devp, fz_image *image, const fz_matrix *ctm, float if (pixmap->colorspace != model && !after) { - fz_bbox bbox; + fz_irect bbox; fz_pixmap_bbox(ctx, pixmap, &bbox); converted = fz_new_pixmap_with_bbox(ctx, model, &bbox); fz_convert_pixmap(ctx, converted, pixmap); @@ -1127,7 +1127,7 @@ fz_draw_fill_image(fz_device *devp, fz_image *image, const fz_matrix *ctm, float } else { - fz_bbox bbox; + fz_irect bbox; fz_pixmap_bbox(ctx, pixmap, &bbox); converted = fz_new_pixmap_with_bbox(ctx, model, &bbox); fz_convert_pixmap(ctx, converted, pixmap); @@ -1167,11 +1167,11 @@ fz_draw_fill_image_mask(fz_device *devp, fz_image *image, const fz_matrix *ctm, fz_context *ctx = dev->ctx; fz_draw_state *state = &dev->stack[dev->top]; fz_colorspace *model = state->dest->colorspace; - fz_bbox clip; + fz_irect clip; fz_matrix local_ctm = *ctm; fz_pixmap_bbox(ctx, state->dest, &clip); - fz_intersect_bbox(&clip, &state->scissor); + fz_intersect_irect(&clip, &state->scissor); if (image->w == 0 || image->h == 0) return; @@ -1230,7 +1230,7 @@ fz_draw_clip_image_mask(fz_device *devp, fz_image *image, const fz_rect *rect, c { fz_draw_device *dev = devp->user; fz_context *ctx = dev->ctx; - fz_bbox bbox; + fz_irect bbox; fz_pixmap *mask = NULL; fz_pixmap *dest = NULL; fz_pixmap *shape = NULL; @@ -1240,12 +1240,12 @@ fz_draw_clip_image_mask(fz_device *devp, fz_image *image, const fz_rect *rect, c int dx, dy; fz_draw_state *state = push_stack(dev); fz_colorspace *model = state->dest->colorspace; - fz_bbox clip; + fz_irect clip; fz_matrix local_ctm = *ctm; fz_rect urect; fz_pixmap_bbox(ctx, state->dest, &clip); - fz_intersect_bbox(&clip, &state->scissor); + fz_intersect_irect(&clip, &state->scissor); fz_var(mask); fz_var(dest); @@ -1258,7 +1258,7 @@ fz_draw_clip_image_mask(fz_device *devp, fz_image *image, const fz_rect *rect, c #ifdef DUMP_GROUP_BLENDS dump_spaces(dev->top-1, "Clip (image mask) (empty) begin\n"); #endif - state[1].scissor = fz_empty_bbox; + state[1].scissor = fz_empty_irect; state[1].mask = NULL; return; } @@ -1268,12 +1268,12 @@ fz_draw_clip_image_mask(fz_device *devp, fz_image *image, const fz_rect *rect, c #endif urect = fz_unit_rect; - fz_bbox_from_rect(&bbox, fz_transform_rect(&urect, &local_ctm)); - fz_intersect_bbox(&bbox, &state->scissor); + fz_irect_from_rect(&bbox, fz_transform_rect(&urect, &local_ctm)); + fz_intersect_irect(&bbox, &state->scissor); if (rect) { - fz_bbox bbox2; - fz_intersect_bbox(&bbox, fz_bbox_from_rect(&bbox2, rect)); + fz_irect bbox2; + fz_intersect_irect(&bbox, fz_irect_from_rect(&bbox2, rect)); } dx = sqrtf(local_ctm.a * local_ctm.a + local_ctm.b * local_ctm.b); @@ -1383,12 +1383,12 @@ fz_draw_begin_mask(fz_device *devp, const fz_rect *rect, int luminosity, fz_colo { fz_draw_device *dev = devp->user; fz_pixmap *dest; - fz_bbox bbox; + fz_irect bbox; fz_draw_state *state = push_stack(dev); fz_pixmap *shape = state->shape; fz_context *ctx = dev->ctx; - fz_intersect_bbox(fz_bbox_from_rect(&bbox, rect), &state->scissor); + fz_intersect_irect(fz_irect_from_rect(&bbox, rect), &state->scissor); fz_try(ctx) { @@ -1438,7 +1438,7 @@ fz_draw_end_mask(fz_device *devp) { fz_draw_device *dev = devp->user; fz_pixmap *temp, *dest; - fz_bbox bbox; + fz_irect bbox; int luminosity; fz_context *ctx = dev->ctx; fz_draw_state *state; @@ -1490,7 +1490,7 @@ static void fz_draw_begin_group(fz_device *devp, const fz_rect *rect, int isolated, int knockout, int blendmode, float alpha) { fz_draw_device *dev = devp->user; - fz_bbox bbox; + fz_irect bbox; fz_pixmap *dest, *shape; fz_context *ctx = dev->ctx; fz_draw_state *state = &dev->stack[dev->top]; @@ -1500,7 +1500,7 @@ fz_draw_begin_group(fz_device *devp, const fz_rect *rect, int isolated, int knoc fz_knockout_begin(dev); state = push_stack(dev); - fz_intersect_bbox(fz_bbox_from_rect(&bbox, rect), &state->scissor); + fz_intersect_irect(fz_irect_from_rect(&bbox, rect), &state->scissor); fz_try(ctx) { @@ -1612,7 +1612,7 @@ fz_draw_begin_tile(fz_device *devp, const fz_rect *area, const fz_rect *view, fl fz_draw_device *dev = devp->user; fz_pixmap *dest = NULL; fz_pixmap *shape; - fz_bbox bbox; + fz_irect bbox; fz_context *ctx = dev->ctx; fz_draw_state *state = &dev->stack[dev->top]; fz_colorspace *model = state->dest->colorspace; @@ -1625,7 +1625,7 @@ fz_draw_begin_tile(fz_device *devp, const fz_rect *area, const fz_rect *view, fl fz_knockout_begin(dev); state = push_stack(dev); - fz_bbox_from_rect(&bbox, fz_transform_rect(&local_view, ctm)); + fz_irect_from_rect(&bbox, fz_transform_rect(&local_view, ctm)); /* 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 @@ -1646,7 +1646,7 @@ fz_draw_begin_tile(fz_device *devp, const fz_rect *area, const fz_rect *view, fl state[1].blendmode |= FZ_BLEND_ISOLATED; state[1].xstep = xstep; state[1].ystep = ystep; - fz_bbox_from_rect(&state[1].area, area); + fz_irect_from_rect(&state[1].area, area); state[1].ctm = *ctm; #ifdef DUMP_GROUP_BLENDS dump_spaces(dev->top-1, "Tile begin\n"); @@ -1667,7 +1667,7 @@ fz_draw_end_tile(fz_device *devp) fz_draw_device *dev = devp->user; float xstep, ystep; fz_matrix ttm, ctm, shapectm; - fz_bbox area, scissor; + fz_irect area, scissor; fz_rect scissor_tmp; int x0, y0, x1, y1, x, y; fz_context *ctx = dev->ctx; @@ -1687,9 +1687,9 @@ fz_draw_end_tile(fz_device *devp) /* Fudge the scissor bbox a little to allow for inaccuracies in the * matrix inversion. */ - fz_rect_from_bbox(&scissor_tmp, &state[0].scissor); + fz_rect_from_irect(&scissor_tmp, &state[0].scissor); fz_transform_rect(fz_expand_rect(&scissor_tmp, 1), fz_invert_matrix(&ttm, &ctm)); - fz_intersect_bbox(&area, fz_bbox_from_rect(&scissor, &scissor_tmp)); + fz_intersect_irect(&area, fz_irect_from_rect(&scissor, &scissor_tmp)); /* FIXME: area is a bbox, so FP not appropriate here */ x0 = floorf(area.x0 / xstep); @@ -1852,7 +1852,7 @@ fz_new_draw_device(fz_context *ctx, fz_pixmap *dest) } fz_device * -fz_new_draw_device_with_bbox(fz_context *ctx, fz_pixmap *dest, const fz_bbox *clip) +fz_new_draw_device_with_bbox(fz_context *ctx, fz_pixmap *dest, const fz_irect *clip) { fz_device *dev = fz_new_draw_device(ctx, dest); fz_draw_device *ddev = dev->user; diff --git a/draw/draw_edge.c b/draw/draw_edge.c index 4f9994d1..138fbcd9 100644 --- a/draw/draw_edge.c +++ b/draw/draw_edge.c @@ -203,11 +203,11 @@ fz_new_gel(fz_context *ctx) } void -fz_reset_gel(fz_gel *gel, const fz_bbox *clip) +fz_reset_gel(fz_gel *gel, const fz_irect *clip) { fz_aa_context *ctxaa = gel->ctx->aa; - if (fz_is_infinite_bbox(clip)) + if (fz_is_infinite_irect(clip)) { gel->clip.x0 = gel->clip.y0 = BBOX_MAX; gel->clip.x1 = gel->clip.y1 = BBOX_MIN; @@ -235,13 +235,13 @@ fz_free_gel(fz_gel *gel) fz_free(gel->ctx, gel); } -fz_bbox * -fz_bound_gel(const fz_gel *gel, fz_bbox *bbox) +fz_irect * +fz_bound_gel(const fz_gel *gel, fz_irect *bbox) { fz_aa_context *ctxaa = gel->ctx->aa; if (gel->len == 0) { - *bbox = fz_empty_bbox; + *bbox = fz_empty_irect; } else { @@ -670,7 +670,7 @@ static inline void blit_aa(fz_pixmap *dst, int x, int y, } static void -fz_scan_convert_aa(fz_gel *gel, int eofill, const fz_bbox *clip, +fz_scan_convert_aa(fz_gel *gel, int eofill, const fz_irect *clip, fz_pixmap *dst, unsigned char *color) { unsigned char *alphas; @@ -855,7 +855,7 @@ clip_ended: */ static inline void blit_sharp(int x0, int x1, int y, - const fz_bbox *clip, fz_pixmap *dst, unsigned char *color) + const fz_irect *clip, fz_pixmap *dst, unsigned char *color) { unsigned char *dp; x0 = fz_clampi(x0, dst->x, dst->x + dst->w); @@ -871,7 +871,7 @@ static inline void blit_sharp(int x0, int x1, int y, } static inline void non_zero_winding_sharp(fz_gel *gel, int y, - const fz_bbox *clip, fz_pixmap *dst, unsigned char *color) + const fz_irect *clip, fz_pixmap *dst, unsigned char *color) { int winding = 0; int x = 0; @@ -887,7 +887,7 @@ static inline void non_zero_winding_sharp(fz_gel *gel, int y, } static inline void even_odd_sharp(fz_gel *gel, int y, - const fz_bbox *clip, fz_pixmap *dst, unsigned char *color) + const fz_irect *clip, fz_pixmap *dst, unsigned char *color) { int even = 0; int x = 0; @@ -903,7 +903,7 @@ static inline void even_odd_sharp(fz_gel *gel, int y, } static void -fz_scan_convert_sharp(fz_gel *gel, int eofill, const fz_bbox *clip, +fz_scan_convert_sharp(fz_gel *gel, int eofill, const fz_irect *clip, fz_pixmap *dst, unsigned char *color) { int e = 0; @@ -959,7 +959,7 @@ fz_scan_convert_sharp(fz_gel *gel, int eofill, const fz_bbox *clip, } void -fz_scan_convert(fz_gel *gel, int eofill, const fz_bbox *clip, +fz_scan_convert(fz_gel *gel, int eofill, const fz_irect *clip, fz_pixmap *dst, unsigned char *color) { fz_aa_context *ctxaa = gel->ctx->aa; diff --git a/draw/draw_glyph.c b/draw/draw_glyph.c index 3ad2f10f..f4d0e16e 100644 --- a/draw/draw_glyph.c +++ b/draw/draw_glyph.c @@ -95,7 +95,7 @@ fz_keep_glyph_cache(fz_context *ctx) } fz_pixmap * -fz_render_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, fz_stroke_state *stroke, fz_bbox scissor) +fz_render_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, fz_stroke_state *stroke, fz_irect scissor) { if (font->ft_face) { @@ -116,7 +116,7 @@ fz_render_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix This must not be inserted into the cache. */ fz_pixmap * -fz_render_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *ctm, fz_colorspace *model, fz_bbox scissor) +fz_render_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *ctm, fz_colorspace *model, fz_irect scissor) { fz_glyph_cache *cache; fz_glyph_key key; @@ -127,7 +127,7 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *ctm, f if (size <= MAX_GLYPH_SIZE) { - scissor = fz_infinite_bbox; + scissor = fz_infinite_irect; do_cache = 1; } else diff --git a/draw/draw_mesh.c b/draw/draw_mesh.c index 343e9302..8c1e0a20 100644 --- a/draw/draw_mesh.c +++ b/draw/draw_mesh.c @@ -213,7 +213,7 @@ static inline void step_edge(int *ael, int *del, int n) } static void -fz_paint_triangle(fz_pixmap *pix, float *av, float *bv, float *cv, int n, const fz_bbox *bbox) +fz_paint_triangle(fz_pixmap *pix, float *av, float *bv, float *cv, int n, const fz_irect *bbox) { float poly[MAXV][MAXN]; float temp[MAXV][MAXN]; @@ -307,7 +307,7 @@ struct paint_tri_data fz_context *ctx; fz_shade *shade; fz_pixmap *dest; - const fz_bbox *bbox; + const fz_irect *bbox; }; static void @@ -349,7 +349,7 @@ do_paint_tri(void *arg, fz_vertex *av, fz_vertex *bv, fz_vertex *cv) } void -fz_paint_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_pixmap *dest, const fz_bbox *bbox) +fz_paint_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_pixmap *dest, const fz_irect *bbox) { unsigned char clut[256][FZ_MAX_COLORS]; fz_pixmap *temp = NULL; diff --git a/draw/draw_paint.c b/draw/draw_paint.c index 2862b892..be8ea20b 100644 --- a/draw/draw_paint.c +++ b/draw/draw_paint.c @@ -375,18 +375,18 @@ fz_paint_span(byte * restrict dp, byte * restrict sp, int n, int w, int alpha) */ void -fz_paint_pixmap_with_bbox(fz_pixmap *dst, fz_pixmap *src, int alpha, fz_bbox bbox) +fz_paint_pixmap_with_bbox(fz_pixmap *dst, fz_pixmap *src, int alpha, fz_irect bbox) { unsigned char *sp, *dp; int x, y, w, h, n; - fz_bbox bbox2; + fz_irect bbox2; assert(dst->n == src->n); fz_pixmap_bbox_no_ctx(dst, &bbox2); - fz_intersect_bbox(&bbox, &bbox2); + fz_intersect_irect(&bbox, &bbox2); fz_pixmap_bbox_no_ctx(src, &bbox2); - fz_intersect_bbox(&bbox, &bbox2); + fz_intersect_irect(&bbox, &bbox2); x = bbox.x0; y = bbox.y0; @@ -411,15 +411,15 @@ void fz_paint_pixmap(fz_pixmap *dst, fz_pixmap *src, int alpha) { unsigned char *sp, *dp; - fz_bbox bbox; - fz_bbox bbox2; + fz_irect bbox; + fz_irect bbox2; int x, y, w, h, n; assert(dst->n == src->n); fz_pixmap_bbox_no_ctx(dst, &bbox); fz_pixmap_bbox_no_ctx(src, &bbox2); - fz_intersect_bbox(&bbox, &bbox2); + fz_intersect_irect(&bbox, &bbox2); x = bbox.x0; y = bbox.y0; @@ -444,7 +444,7 @@ void fz_paint_pixmap_with_mask(fz_pixmap *dst, fz_pixmap *src, fz_pixmap *msk) { unsigned char *sp, *dp, *mp; - fz_bbox bbox, bbox2; + fz_irect bbox, bbox2; int x, y, w, h, n; assert(dst->n == src->n); @@ -452,9 +452,9 @@ fz_paint_pixmap_with_mask(fz_pixmap *dst, fz_pixmap *src, fz_pixmap *msk) fz_pixmap_bbox_no_ctx(dst, &bbox); fz_pixmap_bbox_no_ctx(src, &bbox2); - fz_intersect_bbox(&bbox, &bbox2); + fz_intersect_irect(&bbox, &bbox2); fz_pixmap_bbox_no_ctx(msk, &bbox2); - fz_intersect_bbox(&bbox, &bbox2); + fz_intersect_irect(&bbox, &bbox2); x = bbox.x0; y = bbox.y0; diff --git a/draw/draw_scale.c b/draw/draw_scale.c index e20cc46d..83a72584 100644 --- a/draw/draw_scale.c +++ b/draw/draw_scale.c @@ -1238,13 +1238,13 @@ scale_single_col(unsigned char *dst, unsigned char *src, fz_weights *weights, in #endif /* SINGLE_PIXEL_SPECIALS */ fz_pixmap * -fz_scale_pixmap(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, fz_bbox *clip) +fz_scale_pixmap(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, fz_irect *clip) { return fz_scale_pixmap_cached(ctx, src, x, y, w, h, clip, NULL, NULL); } fz_pixmap * -fz_scale_pixmap_cached(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, const fz_bbox *clip, fz_scale_cache *cache_x, fz_scale_cache *cache_y) +fz_scale_pixmap_cached(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, const fz_irect *clip, fz_scale_cache *cache_x, fz_scale_cache *cache_y) { fz_scale_filter *filter = &fz_scale_filter_simple; fz_weights *contrib_rows = NULL; diff --git a/draw/draw_simple_scale.c b/draw/draw_simple_scale.c index d624aa57..4957b20d 100644 --- a/draw/draw_simple_scale.c +++ b/draw/draw_simple_scale.c @@ -1214,13 +1214,13 @@ scale_single_col(unsigned char *dst, unsigned char *src, fz_weights *weights, in #endif /* SINGLE_PIXEL_SPECIALS */ fz_pixmap * -fz_scale_pixmap(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, fz_bbox *clip) +fz_scale_pixmap(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, fz_irect *clip) { return fz_scale_pixmap_cached(ctx, src, x, y, w, h, clip, NULL, NULL); } fz_pixmap * -fz_scale_pixmap_cached(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, const fz_bbox *clip, fz_scale_cache *cache_x, fz_scale_cache *cache_y) +fz_scale_pixmap_cached(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, const fz_irect *clip, fz_scale_cache *cache_x, fz_scale_cache *cache_y) { fz_scale_filter *filter = &fz_scale_filter_simple; fz_weights *contrib_rows = NULL; diff --git a/fitz/base_geometry.c b/fitz/base_geometry.c index cc69a108..d1d23eb8 100644 --- a/fitz/base_geometry.c +++ b/fitz/base_geometry.c @@ -270,12 +270,12 @@ const fz_rect fz_infinite_rect = { 1, 1, -1, -1 }; const fz_rect fz_empty_rect = { 0, 0, 0, 0 }; const fz_rect fz_unit_rect = { 0, 0, 1, 1 }; -const fz_bbox fz_infinite_bbox = { 1, 1, -1, -1 }; -const fz_bbox fz_empty_bbox = { 0, 0, 0, 0 }; -const fz_bbox fz_unit_bbox = { 0, 0, 1, 1 }; +const fz_irect fz_infinite_irect = { 1, 1, -1, -1 }; +const fz_irect fz_empty_irect = { 0, 0, 0, 0 }; +const fz_irect fz_unit_bbox = { 0, 0, 1, 1 }; -fz_bbox * -fz_bbox_from_rect(fz_bbox *restrict b, const fz_rect *restrict r) +fz_irect * +fz_irect_from_rect(fz_irect *restrict b, const fz_rect *restrict r) { int i; @@ -292,7 +292,7 @@ fz_bbox_from_rect(fz_bbox *restrict b, const fz_rect *restrict r) } fz_rect * -fz_rect_from_bbox(fz_rect *restrict r, const fz_bbox *restrict a) +fz_rect_from_irect(fz_rect *restrict r, const fz_irect *restrict a) { r->x0 = a->x0; r->y0 = a->y0; @@ -301,8 +301,8 @@ fz_rect_from_bbox(fz_rect *restrict r, const fz_bbox *restrict a) return r; } -fz_bbox * -fz_round_rect(fz_bbox * restrict b, const fz_rect *restrict r) +fz_irect * +fz_round_rect(fz_irect * restrict b, const fz_rect *restrict r) { int i; @@ -345,18 +345,18 @@ fz_intersect_rect(fz_rect *restrict a, const fz_rect *restrict b) return a; } -fz_bbox * -fz_intersect_bbox(fz_bbox *restrict a, const fz_bbox *restrict b) +fz_irect * +fz_intersect_irect(fz_irect *restrict a, const fz_irect *restrict b) { /* Check for empty box before infinite box */ - if (fz_is_empty_bbox(a)) return a; - if (fz_is_empty_bbox(b)) + if (fz_is_empty_irect(a)) return a; + if (fz_is_empty_irect(b)) { - *a = fz_empty_bbox; + *a = fz_empty_irect; return a; } - if (fz_is_infinite_bbox(b)) return a; - if (fz_is_infinite_bbox(a)) + if (fz_is_infinite_irect(b)) return a; + if (fz_is_infinite_irect(a)) { *a = *b; return a; @@ -370,7 +370,7 @@ fz_intersect_bbox(fz_bbox *restrict a, const fz_bbox *restrict b) if (a->y1 > b->y1) a->y1 = b->y1; if (a->x1 < a->x0 || a->y1 < a->y0) - *a = fz_empty_bbox; + *a = fz_empty_irect; return a; } @@ -399,13 +399,13 @@ fz_union_rect(fz_rect *restrict a, const fz_rect *restrict b) return a; } -fz_bbox * -fz_translate_bbox(fz_bbox *a, int xoff, int yoff) +fz_irect * +fz_translate_irect(fz_irect *a, int xoff, int yoff) { int t; - if (fz_is_empty_bbox(a)) return a; - if (fz_is_infinite_bbox(a)) return a; + if (fz_is_empty_irect(a)) return a; + if (fz_is_infinite_irect(a)) return a; a->x0 = ADD_WITH_SAT(t, a->x0, xoff); a->y0 = ADD_WITH_SAT(t, a->y0, yoff); a->x1 = ADD_WITH_SAT(t, a->x1, xoff); diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h index cc8efafe..ed18b9d6 100644 --- a/fitz/fitz-internal.h +++ b/fitz/fitz-internal.h @@ -872,22 +872,22 @@ struct fz_pixmap_s void fz_free_pixmap_imp(fz_context *ctx, fz_storable *pix); -void fz_copy_pixmap_rect(fz_context *ctx, fz_pixmap *dest, fz_pixmap *src, const fz_bbox *r); +void fz_copy_pixmap_rect(fz_context *ctx, fz_pixmap *dest, fz_pixmap *src, const fz_irect *r); void fz_premultiply_pixmap(fz_context *ctx, fz_pixmap *pix); fz_pixmap *fz_alpha_from_gray(fz_context *ctx, fz_pixmap *gray, int luminosity); unsigned int fz_pixmap_size(fz_context *ctx, fz_pixmap *pix); -fz_pixmap *fz_scale_pixmap(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, fz_bbox *clip); +fz_pixmap *fz_scale_pixmap(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, fz_irect *clip); typedef struct fz_scale_cache_s fz_scale_cache; fz_scale_cache *fz_new_scale_cache(fz_context *ctx); void fz_free_scale_cache(fz_context *ctx, fz_scale_cache *cache); -fz_pixmap *fz_scale_pixmap_cached(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, const fz_bbox *clip, fz_scale_cache *cache_x, fz_scale_cache *cache_y); +fz_pixmap *fz_scale_pixmap_cached(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, const fz_irect *clip, fz_scale_cache *cache_x, fz_scale_cache *cache_y); void fz_subsample_pixmap(fz_context *ctx, fz_pixmap *tile, int factor); -fz_bbox *fz_pixmap_bbox_no_ctx(fz_pixmap *src, fz_bbox *bbox); +fz_irect *fz_pixmap_bbox_no_ctx(fz_pixmap *src, fz_irect *bbox); typedef struct fz_compression_params_s fz_compression_params; @@ -1187,10 +1187,10 @@ void fz_purge_glyph_cache(fz_context *ctx); fz_path *fz_outline_ft_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm); fz_path *fz_outline_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *ctm); fz_pixmap *fz_render_ft_glyph(fz_context *ctx, fz_font *font, int cid, const fz_matrix *trm, int aa); -fz_pixmap *fz_render_t3_glyph(fz_context *ctx, fz_font *font, int cid, const fz_matrix *trm, fz_colorspace *model, fz_bbox scissor); +fz_pixmap *fz_render_t3_glyph(fz_context *ctx, fz_font *font, int cid, const fz_matrix *trm, fz_colorspace *model, fz_irect scissor); fz_pixmap *fz_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, fz_stroke_state *state); -fz_pixmap *fz_render_glyph(fz_context *ctx, fz_font*, int, const fz_matrix *, fz_colorspace *model, fz_bbox scissor); -fz_pixmap *fz_render_stroked_glyph(fz_context *ctx, fz_font*, int, const fz_matrix *, const fz_matrix *, fz_stroke_state *stroke, fz_bbox scissor); +fz_pixmap *fz_render_glyph(fz_context *ctx, fz_font*, int, const fz_matrix *, fz_colorspace *model, fz_irect scissor); +fz_pixmap *fz_render_stroked_glyph(fz_context *ctx, fz_font*, int, const fz_matrix *, const fz_matrix *, fz_stroke_state *stroke, fz_irect scissor); void fz_render_t3_glyph_direct(fz_context *ctx, fz_device *dev, fz_font *font, int gid, const fz_matrix *trm, void *gstate, int nestedDepth); void fz_prepare_t3_glyph(fz_context *ctx, fz_font *font, int gid, int nestedDepth); @@ -1318,7 +1318,7 @@ void fz_drop_shade(fz_context *ctx, fz_shade *shade); void fz_free_shade_imp(fz_context *ctx, fz_storable *shade); fz_rect *fz_bound_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_rect *r); -void fz_paint_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_pixmap *dest, const fz_bbox *bbox); +void fz_paint_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_pixmap *dest, const fz_irect *bbox); /* * Handy routine for processing mesh based shades @@ -1357,13 +1357,13 @@ typedef struct fz_gel_s fz_gel; fz_gel *fz_new_gel(fz_context *ctx); void fz_insert_gel(fz_gel *gel, float x0, float y0, float x1, float y1); -void fz_reset_gel(fz_gel *gel, const fz_bbox *clip); +void fz_reset_gel(fz_gel *gel, const fz_irect *clip); void fz_sort_gel(fz_gel *gel); -fz_bbox *fz_bound_gel(const fz_gel *gel, fz_bbox *bbox); +fz_irect *fz_bound_gel(const fz_gel *gel, fz_irect *bbox); void fz_free_gel(fz_gel *gel); int fz_is_rect_gel(fz_gel *gel); -void fz_scan_convert(fz_gel *gel, int eofill, const fz_bbox *clip, fz_pixmap *pix, unsigned char *colorbv); +void fz_scan_convert(fz_gel *gel, int eofill, const fz_irect *clip, fz_pixmap *pix, unsigned char *colorbv); void fz_flatten_fill_path(fz_gel *gel, fz_path *path, const fz_matrix *ctm, float flatness); void fz_flatten_stroke_path(fz_gel *gel, fz_path *path, fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth); @@ -1476,12 +1476,12 @@ void fz_paint_solid_color(unsigned char * restrict dp, int n, int w, unsigned ch void fz_paint_span(unsigned char * restrict dp, unsigned char * restrict sp, int n, int w, int alpha); void fz_paint_span_with_color(unsigned char * restrict dp, unsigned char * restrict mp, int n, int w, unsigned char *color); -void fz_paint_image(fz_pixmap *dst, const fz_bbox *scissor, fz_pixmap *shape, fz_pixmap *img, const fz_matrix *ctm, int alpha); -void fz_paint_image_with_color(fz_pixmap *dst, const fz_bbox *scissor, fz_pixmap *shape, fz_pixmap *img, const fz_matrix *ctm, unsigned char *colorbv); +void fz_paint_image(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz_pixmap *img, const fz_matrix *ctm, int alpha); +void fz_paint_image_with_color(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz_pixmap *img, const fz_matrix *ctm, unsigned char *colorbv); void fz_paint_pixmap(fz_pixmap *dst, fz_pixmap *src, int alpha); void fz_paint_pixmap_with_mask(fz_pixmap *dst, fz_pixmap *src, fz_pixmap *msk); -void fz_paint_pixmap_with_bbox(fz_pixmap *dst, fz_pixmap *src, int alpha, fz_bbox bbox); +void fz_paint_pixmap_with_bbox(fz_pixmap *dst, fz_pixmap *src, int alpha, fz_irect bbox); void fz_blend_pixmap(fz_pixmap *dst, fz_pixmap *src, int alpha, int blendmode, int isolated, fz_pixmap *shape); void fz_blend_pixel(unsigned char dp[3], unsigned char bp[3], unsigned char sp[3], int blendmode); diff --git a/fitz/fitz.h b/fitz/fitz.h index 9fe3597e..a0f29dd9 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -764,12 +764,12 @@ static inline fz_point *fz_rect_max(fz_rect *f) } /* - fz_bbox is a rectangle using integers instead of floats. + fz_irect is a rectangle using integers instead of floats. It's used in the draw device and for pixmap dimensions. */ -typedef struct fz_bbox_s fz_bbox; -struct fz_bbox_s +typedef struct fz_irect_s fz_irect; +struct fz_irect_s { int x0, y0; int x1, y1; @@ -789,7 +789,7 @@ extern const fz_rect fz_unit_rect; Both the top left and bottom right corner are at (0, 0). */ extern const fz_rect fz_empty_rect; -extern const fz_bbox fz_empty_bbox; +extern const fz_irect fz_empty_irect; /* An infinite rectangle with negative area. @@ -798,7 +798,7 @@ extern const fz_bbox fz_empty_bbox; at (-1, -1). */ extern const fz_rect fz_infinite_rect; -extern const fz_bbox fz_infinite_bbox; +extern const fz_irect fz_infinite_irect; /* fz_is_empty_rect: Check if rectangle is empty. @@ -812,7 +812,7 @@ fz_is_empty_rect(const fz_rect *r) } static inline int -fz_is_empty_bbox(const fz_bbox *r) +fz_is_empty_irect(const fz_irect *r) { return ((r)->x0 == (r)->x1 || (r)->y0 == (r)->y1); } @@ -830,7 +830,7 @@ fz_is_infinite_rect(const fz_rect *r) } static inline int -fz_is_infinite_bbox(const fz_bbox *r) +fz_is_infinite_irect(const fz_irect *r) { return ((r)->x0 > (r)->x1 || (r)->y0 > (r)->y1); } @@ -1056,14 +1056,14 @@ float fz_matrix_expansion(const fz_matrix *m); /* sumatrapdf */ fz_rect *fz_intersect_rect(fz_rect *a, const fz_rect *b); /* - fz_intersect_bbox: Compute intersection of two bounding boxes. + fz_intersect_irect: Compute intersection of two bounding boxes. Similar to fz_intersect_rect but operates on two bounding boxes instead of two rectangles. Does not throw exceptions. */ -fz_bbox *fz_intersect_bbox(fz_bbox *a, const fz_bbox *b); +fz_irect *fz_intersect_irect(fz_irect *a, const fz_irect *b); /* fz_union_rect: Compute union of two rectangles. @@ -1080,7 +1080,7 @@ fz_bbox *fz_intersect_bbox(fz_bbox *a, const fz_bbox *b); fz_rect *fz_union_rect(fz_rect *a, const fz_rect *b); /* - fz_bbox_from_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. bbox: Place to store the returned bbox. @@ -1097,7 +1097,7 @@ fz_rect *fz_union_rect(fz_rect *a, const fz_rect *b); Does not throw exceptions. */ -fz_bbox *fz_bbox_from_rect(fz_bbox *bbox, const fz_rect *rect); +fz_irect *fz_irect_from_rect(fz_irect *bbox, const fz_rect *rect); /* fz_round_rect: Round rectangle coordinates. @@ -1107,7 +1107,7 @@ fz_bbox *fz_bbox_from_rect(fz_bbox *bbox, const fz_rect *rect); upwards and left while the bottom right corner is rounded downwards and to the right. - This differs from fz_bbox_from_rect, in that fz_bbox_from_rect + This differs from fz_irect_from_rect, in that fz_irect_from_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 @@ -1115,10 +1115,10 @@ fz_bbox *fz_bbox_from_rect(fz_bbox *bbox, const fz_rect *rect); Does not throw exceptions. */ -fz_bbox *fz_round_rect(fz_bbox *bbox, const fz_rect *rect); +fz_irect *fz_round_rect(fz_irect *bbox, const fz_rect *rect); /* - fz_rect_from_bbox: Convert a bbox into a rect. + fz_rect_from_irect: Convert a bbox into a rect. For our purposes, a rect can represent all the values we meet in a bbox, so nothing can go wrong. @@ -1131,7 +1131,7 @@ fz_bbox *fz_round_rect(fz_bbox *bbox, const fz_rect *rect); Does not throw exceptions. */ -fz_rect *fz_rect_from_bbox(fz_rect *rect, const fz_bbox *bbox); +fz_rect *fz_rect_from_irect(fz_rect *rect, const fz_irect *bbox); /* fz_expand_rect: Expand a bbox by a given amount in all directions. @@ -1141,13 +1141,13 @@ fz_rect *fz_rect_from_bbox(fz_rect *rect, const fz_bbox *bbox); fz_rect *fz_expand_rect(fz_rect *b, float expand); /* - fz_translate_bbox: Translate bounding box. + fz_translate_irect: Translate bounding box. Translate a bbox by a given x and y offset. Allows for overflow. Does not throw exceptions. */ -fz_bbox *fz_translate_bbox(fz_bbox *a, int xoff, int yoff); +fz_irect *fz_translate_irect(fz_irect *a, int xoff, int yoff); /* fz_translate_rect: Translate rectangle. @@ -1435,7 +1435,7 @@ typedef struct fz_pixmap_s fz_pixmap; /* fz_pixmap_bbox: Return the bounding box for a pixmap. */ -fz_bbox *fz_pixmap_bbox(fz_context *ctx, fz_pixmap *pix, fz_bbox *bbox); +fz_irect *fz_pixmap_bbox(fz_context *ctx, fz_pixmap *pix, fz_irect *bbox); /* fz_pixmap_width: Return the width of the pixmap in pixels. @@ -1479,7 +1479,7 @@ fz_pixmap *fz_new_pixmap(fz_context *ctx, fz_colorspace *cs, int w, int h); Returns a pointer to the new pixmap. Throws exception on failure to allocate. */ -fz_pixmap *fz_new_pixmap_with_bbox(fz_context *ctx, fz_colorspace *colorspace, const fz_bbox *bbox); +fz_pixmap *fz_new_pixmap_with_bbox(fz_context *ctx, fz_colorspace *colorspace, const fz_irect *bbox); /* fz_new_pixmap_with_data: Create a new pixmap, with it's origin at @@ -1518,7 +1518,7 @@ fz_pixmap *fz_new_pixmap_with_data(fz_context *ctx, fz_colorspace *colorspace, i Returns a pointer to the new pixmap. Throws exception on failure to allocate. */ -fz_pixmap *fz_new_pixmap_with_bbox_and_data(fz_context *ctx, fz_colorspace *colorspace, const fz_bbox *rect, unsigned char *samples); +fz_pixmap *fz_new_pixmap_with_bbox_and_data(fz_context *ctx, fz_colorspace *colorspace, const fz_irect *rect, unsigned char *samples); /* fz_keep_pixmap: Take a reference to a pixmap. @@ -1586,7 +1586,7 @@ void fz_clear_pixmap_with_value(fz_context *ctx, fz_pixmap *pix, int value); Does not throw exceptions. */ -void fz_clear_pixmap_rect_with_value(fz_context *ctx, fz_pixmap *pix, int value, const fz_bbox *r); +void fz_clear_pixmap_rect_with_value(fz_context *ctx, fz_pixmap *pix, int value, const fz_irect *r); /* fz_clear_pixmap_with_value: Sets all components (including alpha) of @@ -1613,7 +1613,7 @@ void fz_invert_pixmap(fz_context *ctx, fz_pixmap *pix); Does not throw exceptions. */ -void fz_invert_pixmap_rect(fz_pixmap *image, const fz_bbox *rect); +void fz_invert_pixmap_rect(fz_pixmap *image, const fz_irect *rect); /* fz_gamma_pixmap: Apply gamma correction to a pixmap. All components @@ -1814,7 +1814,7 @@ fz_device *fz_new_draw_device(fz_context *ctx, fz_pixmap *dest); clip: Bounding box to restrict any marking operations of the draw device. */ -fz_device *fz_new_draw_device_with_bbox(fz_context *ctx, fz_pixmap *dest, const fz_bbox *clip); +fz_device *fz_new_draw_device_with_bbox(fz_context *ctx, fz_pixmap *dest, const fz_irect *clip); /* Text extraction device: Used for searching, format conversion etc. diff --git a/fitz/image_save.c b/fitz/image_save.c index 4f006f18..b0856507 100644 --- a/fitz/image_save.c +++ b/fitz/image_save.c @@ -10,7 +10,7 @@ void fz_write_pixmap(fz_context *ctx, fz_pixmap *img, char *file, int rgb) if (rgb && img->colorspace && img->colorspace != fz_device_rgb) { - fz_bbox bbox; + fz_irect bbox; converted = fz_new_pixmap_with_bbox(ctx, fz_device_rgb, fz_pixmap_bbox(ctx, img, &bbox)); fz_convert_pixmap(ctx, converted, img); img = converted; diff --git a/fitz/res_font.c b/fitz/res_font.c index e4882640..cef70d55 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -902,12 +902,12 @@ fz_bound_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, } fz_pixmap * -fz_render_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_colorspace *model, fz_bbox scissor) +fz_render_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_colorspace *model, fz_irect scissor) { fz_display_list *list; fz_matrix ctm; fz_rect bounds; - fz_bbox bbox; + fz_irect bbox; fz_device *dev; fz_pixmap *glyph; fz_pixmap *result; @@ -937,8 +937,8 @@ fz_render_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm } fz_expand_rect(fz_bound_glyph(ctx, font, gid, trm, &bounds), 1); - fz_bbox_from_rect(&bbox, &bounds); - fz_intersect_bbox(&bbox, &scissor); + fz_irect_from_rect(&bbox, &bounds); + fz_intersect_irect(&bbox, &scissor); glyph = fz_new_pixmap_with_bbox(ctx, model ? model : fz_device_gray, &bbox); fz_clear_pixmap(ctx, glyph); diff --git a/fitz/res_pixmap.c b/fitz/res_pixmap.c index 53d0116a..08e88a32 100644 --- a/fitz/res_pixmap.c +++ b/fitz/res_pixmap.c @@ -83,7 +83,7 @@ fz_new_pixmap(fz_context *ctx, fz_colorspace *colorspace, int w, int h) } fz_pixmap * -fz_new_pixmap_with_bbox(fz_context *ctx, fz_colorspace *colorspace, const fz_bbox *r) +fz_new_pixmap_with_bbox(fz_context *ctx, fz_colorspace *colorspace, const fz_irect *r) { fz_pixmap *pixmap; pixmap = fz_new_pixmap(ctx, colorspace, r->x1 - r->x0, r->y1 - r->y0); @@ -93,7 +93,7 @@ fz_new_pixmap_with_bbox(fz_context *ctx, fz_colorspace *colorspace, const fz_bbo } fz_pixmap * -fz_new_pixmap_with_bbox_and_data(fz_context *ctx, fz_colorspace *colorspace, const fz_bbox *r, unsigned char *samples) +fz_new_pixmap_with_bbox_and_data(fz_context *ctx, fz_colorspace *colorspace, const fz_irect *r, unsigned char *samples) { fz_pixmap *pixmap = fz_new_pixmap_with_data(ctx, colorspace, r->x1 - r->x0, r->y1 - r->y0, samples); pixmap->x = r->x0; @@ -101,8 +101,8 @@ fz_new_pixmap_with_bbox_and_data(fz_context *ctx, fz_colorspace *colorspace, con return pixmap; } -fz_bbox * -fz_pixmap_bbox(fz_context *ctx, fz_pixmap *pix, fz_bbox *bbox) +fz_irect * +fz_pixmap_bbox(fz_context *ctx, fz_pixmap *pix, fz_irect *bbox) { bbox->x0 = pix->x; bbox->y0 = pix->y; @@ -111,8 +111,8 @@ fz_pixmap_bbox(fz_context *ctx, fz_pixmap *pix, fz_bbox *bbox) return bbox; } -fz_bbox * -fz_pixmap_bbox_no_ctx(fz_pixmap *pix, fz_bbox *bbox) +fz_irect * +fz_pixmap_bbox_no_ctx(fz_pixmap *pix, fz_irect *bbox) { bbox->x0 = pix->x; bbox->y0 = pix->y; @@ -163,16 +163,16 @@ fz_clear_pixmap_with_value(fz_context *ctx, fz_pixmap *pix, int value) } void -fz_copy_pixmap_rect(fz_context *ctx, fz_pixmap *dest, fz_pixmap *src, const fz_bbox *b) +fz_copy_pixmap_rect(fz_context *ctx, fz_pixmap *dest, fz_pixmap *src, const fz_irect *b) { const unsigned char *srcp; unsigned char *destp; int x, y, w, destspan, srcspan; - fz_bbox local_b, bb; + fz_irect local_b, bb; local_b = *b; - fz_intersect_bbox(&local_b, fz_pixmap_bbox(ctx, dest, &bb)); - fz_intersect_bbox(&local_b, fz_pixmap_bbox(ctx, src, &bb)); + fz_intersect_irect(&local_b, fz_pixmap_bbox(ctx, dest, &bb)); + fz_intersect_irect(&local_b, fz_pixmap_bbox(ctx, src, &bb)); w = local_b.x1 - local_b.x0; y = local_b.y1 - local_b.y0; if (w <= 0 || y <= 0) @@ -265,14 +265,14 @@ fz_copy_pixmap_rect(fz_context *ctx, fz_pixmap *dest, fz_pixmap *src, const fz_b } void -fz_clear_pixmap_rect_with_value(fz_context *ctx, fz_pixmap *dest, int value, const fz_bbox *b) +fz_clear_pixmap_rect_with_value(fz_context *ctx, fz_pixmap *dest, int value, const fz_irect *b) { unsigned char *destp; int x, y, w, k, destspan; - fz_bbox bb; - fz_bbox local_b = *b; + fz_irect bb; + fz_irect local_b = *b; - fz_intersect_bbox(&local_b, fz_pixmap_bbox(ctx, dest, &bb)); + fz_intersect_irect(&local_b, fz_pixmap_bbox(ctx, dest, &bb)); w = local_b.x1 - local_b.x0; y = local_b.y1 - local_b.y0; if (w <= 0 || y <= 0) @@ -347,7 +347,7 @@ fz_alpha_from_gray(fz_context *ctx, fz_pixmap *gray, int luminosity) fz_pixmap *alpha; unsigned char *sp, *dp; int len; - fz_bbox bbox; + fz_irect bbox; assert(gray->n == 2); @@ -384,7 +384,7 @@ fz_invert_pixmap(fz_context *ctx, fz_pixmap *pix) } } -void fz_invert_pixmap_rect(fz_pixmap *image, const fz_bbox *rect) +void fz_invert_pixmap_rect(fz_pixmap *image, const fz_irect *rect) { unsigned char *p; int x, y, n; diff --git a/pdf/pdf_colorspace.c b/pdf/pdf_colorspace.c index 30a45bde..14dc5337 100644 --- a/pdf/pdf_colorspace.c +++ b/pdf/pdf_colorspace.c @@ -183,7 +183,7 @@ pdf_expand_indexed_pixmap(fz_context *ctx, fz_pixmap *src) unsigned char *s, *d; int y, x, k, n, high; unsigned char *lookup; - fz_bbox bbox; + fz_irect bbox; assert(src->colorspace->to_rgb == indexed_to_rgb); assert(src->n == 2); |