summaryrefslogtreecommitdiff
path: root/platform/x11/pdfapp.c
diff options
context:
space:
mode:
Diffstat (limited to 'platform/x11/pdfapp.c')
-rw-r--r--platform/x11/pdfapp.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c
index 17af3d0f..20f4cc46 100644
--- a/platform/x11/pdfapp.c
+++ b/platform/x11/pdfapp.c
@@ -148,8 +148,7 @@ void pdfapp_setresolution(pdfapp_t *app, int res)
void pdfapp_invert(pdfapp_t *app, const fz_rect *rect)
{
- fz_irect b;
- fz_invert_pixmap_rect(app->ctx, app->image, fz_round_rect(&b, rect));
+ fz_invert_pixmap_rect(app->ctx, app->image, fz_round_rect(*rect));
}
void pdfapp_reloadfile(pdfapp_t *app)
@@ -262,7 +261,7 @@ static int make_fake_doc(pdfapp_t *app)
/* Create enough copies of our blank(ish) page so that the
* page number is preserved if and when a subsequent load
* works. */
- page_obj = pdf_add_page(ctx, pdf, &mediabox, 0, NULL, contents);
+ page_obj = pdf_add_page(ctx, pdf, mediabox, 0, NULL, contents);
for (i = 0; i < app->pagecount; i++)
pdf_insert_page(ctx, pdf, -1, page_obj);
}
@@ -606,7 +605,7 @@ int pdfapp_preclose(pdfapp_t *app)
static void pdfapp_viewctm(fz_matrix *mat, pdfapp_t *app)
{
- fz_pre_rotate(fz_scale(mat, app->resolution/72.0f, app->resolution/72.0f), app->rotate);
+ *mat = fz_pre_rotate(fz_scale(app->resolution/72.0f, app->resolution/72.0f), app->rotate);
}
static void pdfapp_panview(pdfapp_t *app, int newx, int newy)
@@ -671,8 +670,7 @@ static void pdfapp_loadpage(pdfapp_t *app, int no_cache)
fz_try(app->ctx)
{
app->page = fz_load_page(app->ctx, app->doc, app->pageno - 1);
-
- fz_bound_page(app->ctx, app->page, &app->page_bbox);
+ app->page_bbox = fz_bound_page(app->ctx, app->page);
}
fz_catch(app->ctx)
{
@@ -687,7 +685,7 @@ static void pdfapp_loadpage(pdfapp_t *app, int no_cache)
{
fz_annot *annot;
/* Create display lists */
- app->page_list = fz_new_display_list(app->ctx, NULL);
+ app->page_list = fz_new_display_list(app->ctx, fz_infinite_rect);
mdev = fz_new_list_device(app->ctx, app->page_list);
if (no_cache)
fz_enable_device_hints(app->ctx, mdev, FZ_NO_CACHE);
@@ -696,7 +694,7 @@ static void pdfapp_loadpage(pdfapp_t *app, int no_cache)
fz_close_device(app->ctx, mdev);
fz_drop_device(app->ctx, mdev);
mdev = NULL;
- app->annotations_list = fz_new_display_list(app->ctx, NULL);
+ app->annotations_list = fz_new_display_list(app->ctx, fz_infinite_rect);
mdev = fz_new_list_device(app->ctx, app->annotations_list);
for (annot = fz_first_annot(app->ctx, app->page); annot; annot = fz_next_annot(app->ctx, annot))
fz_run_annot(app->ctx, annot, mdev, &fz_identity, &cookie);
@@ -757,7 +755,7 @@ static void pdfapp_recreate_annotationslist(pdfapp_t *app)
{
fz_annot *annot;
/* Create display list */
- app->annotations_list = fz_new_display_list(app->ctx, NULL);
+ app->annotations_list = fz_new_display_list(app->ctx, fz_infinite_rect);
mdev = fz_new_list_device(app->ctx, app->annotations_list);
for (annot = fz_first_annot(app->ctx, app->page); annot; annot = fz_next_annot(app->ctx, annot))
fz_run_annot(app->ctx, annot, mdev, &fz_identity, &cookie);
@@ -813,9 +811,10 @@ static void pdfapp_updatepage(pdfapp_t *app)
fz_annot *annot = (fz_annot*)pannot;
fz_rect bounds;
fz_irect ibounds;
- fz_transform_rect(fz_bound_annot(app->ctx, annot, &bounds), &ctm);
- fz_rect_from_irect(&bounds, fz_round_rect(&ibounds, &bounds));
- fz_clear_pixmap_rect_with_value(app->ctx, app->image, 255, &ibounds);
+ bounds = fz_transform_rect(fz_bound_annot(app->ctx, annot), ctm);
+ ibounds = fz_round_rect(bounds);
+ bounds = fz_rect_from_irect(ibounds);
+ fz_clear_pixmap_rect_with_value(app->ctx, app->image, 255, ibounds);
idev = fz_new_draw_device_with_bbox(app->ctx, NULL, app->image, &ibounds);
fz_try(app->ctx)
{
@@ -878,7 +877,8 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
app->hit_count = 0;
/* Extract text */
- app->page_text = fz_new_stext_page(app->ctx, fz_bound_page(app->ctx, app->page, &mediabox));
+ mediabox = fz_bound_page(app->ctx, app->page);
+ app->page_text = fz_new_stext_page(app->ctx, mediabox);
if (app->page_list || app->annotations_list)
{
@@ -914,9 +914,9 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
wintitle(app, buf);
pdfapp_viewctm(&ctm, app);
- bounds = app->page_bbox;
- fz_round_rect(&ibounds, fz_transform_rect(&bounds, &ctm));
- fz_rect_from_irect(&bounds, &ibounds);
+ bounds = fz_transform_rect(app->page_bbox, ctm);
+ ibounds = fz_round_rect(bounds);
+ bounds = fz_rect_from_irect(ibounds);
/* Draw */
fz_drop_pixmap(app->ctx, app->image);
@@ -931,7 +931,7 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
fz_try(app->ctx)
{
- app->image = fz_new_pixmap_with_bbox(app->ctx, colorspace, &ibounds, NULL, 1);
+ app->image = fz_new_pixmap_with_bbox(app->ctx, colorspace, ibounds, NULL, 1);
fz_clear_pixmap_with_value(app->ctx, app->image, 255);
if (app->page_list || app->annotations_list)
{
@@ -958,7 +958,7 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
colorspace = fz_device_gray(app->ctx);
else
colorspace = app->colorspace;
- app->image = fz_new_pixmap_with_bbox(app->ctx, colorspace, &ibounds, NULL, 1);
+ app->image = fz_new_pixmap_with_bbox(app->ctx, colorspace, ibounds, NULL, 1);
app->duration = 0;
fz_page_presentation(app->ctx, app->page, &app->transition, &app->duration);
if (app->duration == 0)
@@ -1051,7 +1051,8 @@ void pdfapp_inverthit(pdfapp_t *app)
for (i = 0; i < app->hit_count; i++)
{
bbox = fz_rect_from_quad(app->hit_bbox[i]);
- pdfapp_invert(app, fz_transform_rect(&bbox, &ctm));
+ bbox = fz_transform_rect(bbox, ctm);
+ pdfapp_invert(app, &bbox);
}
}
@@ -1624,14 +1625,14 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta
int processed = 0;
if (app->image)
- fz_pixmap_bbox(app->ctx, app->image, &irect);
+ irect = fz_pixmap_bbox(app->ctx, app->image);
p.x = x - app->panx + irect.x0;
p.y = y - app->pany + irect.y0;
pdfapp_viewctm(&ctm, app);
- fz_invert_matrix(&ctm, &ctm);
+ ctm = fz_invert_matrix(ctm);
- fz_transform_point(&p, &ctm);
+ p = fz_transform_point(p, ctm);
if (btn == 1 && (state == 1 || state == -1))
{
@@ -1767,8 +1768,7 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta
fz_annot *annot;
for (annot = fz_first_annot(app->ctx, app->page); annot; annot = fz_next_annot(app->ctx, annot))
{
- fz_rect rect;
- fz_bound_annot(app->ctx, annot, &rect);
+ fz_rect rect = fz_bound_annot(app->ctx, annot);
if (x >= rect.x0 && x < rect.x1)
if (y >= rect.y0 && y < rect.y1)
break;
@@ -1921,9 +1921,8 @@ void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen)
fz_rect sel;
pdfapp_viewctm(&ctm, app);
- fz_invert_matrix(&ctm, &ctm);
- sel = app->selr;
- fz_transform_rect(&sel, &ctm);
+ ctm = fz_invert_matrix(ctm);
+ sel = fz_transform_rect(app->selr, ctm);
p = 0;
need_newline = 0;