diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2013-01-30 13:54:39 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2013-01-30 14:13:01 +0100 |
commit | 594c64f744862b993bcad12e05217f3d43e7d547 (patch) | |
tree | 5328ba05eb7c360c25bdc1849604839ce8d99762 /apps | |
parent | 29f09279714f4f9b81d9b5488072860142f86f24 (diff) | |
download | mupdf-594c64f744862b993bcad12e05217f3d43e7d547.tar.xz |
Introduce fz_irect where the old fz_bbox was useful.
Inside the renderer we often deal with integer sized areas, for
pixmaps and scissoring regions. Use a new fz_irect type in these
places.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/mudraw.c | 5 | ||||
-rw-r--r-- | apps/pdfapp.c | 21 |
2 files changed, 15 insertions, 11 deletions
diff --git a/apps/mudraw.c b/apps/mudraw.c index 84c02682..cf9864ec 100644 --- a/apps/mudraw.c +++ b/apps/mudraw.c @@ -402,7 +402,8 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) { float zoom; fz_matrix ctm; - fz_rect bounds, tbounds, ibounds; + fz_rect bounds, tbounds; + fz_irect ibounds; fz_pixmap *pix = NULL; int w, h; @@ -477,7 +478,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) dev = fz_new_draw_device(ctx, pix); if (list) - fz_run_display_list(list, dev, ctm, ibounds, &cookie); + fz_run_display_list(list, dev, ctm, tbounds, &cookie); else fz_run_page(doc, page, dev, ctm, &cookie); fz_free_device(dev); diff --git a/apps/pdfapp.c b/apps/pdfapp.c index 167c118d..1d2a2fa2 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, fz_rect rect) { - fz_invert_pixmap_rect(app->image, rect); + fz_invert_pixmap_rect(app->image, fz_round_rect(rect)); } static void event_cb(fz_doc_event *event, void *data) @@ -566,14 +566,15 @@ static void pdfapp_updatepage(pdfapp_t *app) while ((annot = fz_poll_changed_annot(idoc, app->page)) != NULL) { - fz_rect bbox = fz_transform_rect(ctm, fz_bound_annot(app->doc, annot)); + fz_rect bounds = fz_transform_rect(ctm, fz_bound_annot(app->doc, annot)); + fz_irect bbox = fz_round_rect(bounds); fz_clear_pixmap_rect_with_value(app->ctx, app->image, 255, bbox); idev = fz_new_draw_device_with_bbox(app->ctx, app->image, bbox); if (app->page_list) - fz_run_display_list(app->page_list, idev, ctm, bbox, NULL); + fz_run_display_list(app->page_list, idev, ctm, bounds, NULL); if (app->annotations_list) - fz_run_display_list(app->annotations_list, idev, ctm, bbox, NULL); + fz_run_display_list(app->annotations_list, idev, ctm, bounds, NULL); fz_free_device(idev); } @@ -589,7 +590,8 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai fz_device *tdev; fz_colorspace *colorspace; fz_matrix ctm; - fz_rect bbox; + fz_rect bounds; + fz_irect bbox; fz_cookie cookie = { 0 }; if (!app->nowaitcursor) @@ -646,7 +648,8 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai wintitle(app, buf); ctm = pdfapp_viewctm(app); - bbox = fz_transform_rect(ctm, app->page_bbox); + bounds = fz_transform_rect(ctm, app->page_bbox); + bbox = fz_round_rect(bounds); /* Draw */ if (app->image) @@ -662,9 +665,9 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai { idev = fz_new_draw_device(app->ctx, app->image); if (app->page_list) - fz_run_display_list(app->page_list, idev, ctm, bbox, &cookie); + fz_run_display_list(app->page_list, idev, ctm, bounds, &cookie); if (app->annotations_list) - fz_run_display_list(app->annotations_list, idev, ctm, bbox, &cookie); + fz_run_display_list(app->annotations_list, idev, ctm, bounds, &cookie); fz_free_device(idev); } if (app->invert) @@ -1336,7 +1339,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_rect rect = fz_pixmap_bbox(app->ctx, app->image); + fz_irect rect = fz_pixmap_bbox(app->ctx, app->image); fz_link *link; fz_matrix ctm; fz_point p; |