Revert a bunch of syncs

Things are rather sad. Segfaults, compilation problems, etc, on top of
that Tor is on vaccation. So let's take it slow and stick to a
slightly outdated mupdf, but at least it works (that's not to say that
those are mupdf problems)
This commit is contained in:
malc 2016-07-12 14:44:22 +03:00
parent ba1468ec6f
commit 0d4bb2720f
2 changed files with 11 additions and 20 deletions

View file

@ -11,7 +11,7 @@ Prerequisites for building from sources:
llpp% git clone git://git.ghostscript.com/mupdf.git --recursive
llpp% cd mupdf
mupdf% git checkout 67af3ff2d92e5d0f28e1a4b8b2305c1068e46b83
mupdf% git checkout e2a85460370a3110b89fb838bc924c73f87f5b3c
mupdf% git submodule update --recursive
mupdf% make build=native libs
mupdf% cd ..

29
link.c
View file

@ -644,11 +644,8 @@ static void trimctm (pdf_page *page, int pindex)
fz_matrix ctm;
struct pagedim *pdim = &state.pagedims[pindex];
if (!page) {
ctm = fz_identity;
}
else {
if (!pdim->tctmready) {
if (!pdim->tctmready) {
if (state.trimmargins) {
fz_rect realbox, mediabox;
fz_matrix rm, sm, tm, im, ctm1, page_ctm;
@ -663,9 +660,12 @@ static void trimctm (pdf_page *page, int pindex)
fz_invert_matrix (&im, &page_ctm);
fz_concat (&ctm, &im, &ctm1);
}
else {
ctm = fz_identity;
}
pdim->tctm = ctm;
pdim->tctmready = 1;
}
pdim->tctm = ctm;
pdim->tctmready = 1;
}
static fz_matrix pagectm1 (fz_page *fzpage, struct pagedim *pdim)
@ -709,7 +709,6 @@ static void *loadpage (int pageno, int pindex)
fz_catch (state.ctx) {
page->fzpage = NULL;
}
fz_close_device (state.ctx, dev);
fz_drop_device (state.ctx, dev);
page->pdimno = pindex;
@ -797,7 +796,6 @@ static struct tile *rendertile (struct page *page, int x, int y, int w, int h,
ctm = pagectm (page);
fz_rect_from_irect (&rect, &bbox);
fz_run_display_list (state.ctx, page->dlist, dev, &ctm, &rect, NULL);
fz_close_device (state.ctx, dev);
fz_drop_device (state.ctx, dev);
return tile;
@ -942,7 +940,6 @@ static void initpdims (int wthack)
pdf_page_transform (ctx, page, &mediabox, &page_ctm);
fz_invert_matrix (&ctm, &page_ctm);
pdf_run_page (ctx, page, dev, &fz_identity, NULL);
fz_close_device (state.ctx, dev);
fz_drop_device (ctx, dev);
rect.x0 += state.trimfuzz.x0;
@ -1045,7 +1042,6 @@ static void initpdims (int wthack)
dev = fz_new_bbox_device (ctx, &rect);
dev->hints |= FZ_IGNORE_SHADE;
fz_run_page (ctx, page, dev, &fz_identity, NULL);
fz_close_device (state.ctx, dev);
fz_drop_device (ctx, dev);
rect.x0 += state.trimfuzz.x0;
@ -1493,7 +1489,6 @@ static void search (regex_t *re, int pageno, int y, int forward)
}
qsort (text->blocks, text->len, sizeof (*text->blocks), compareblocks);
fz_close_device (state.ctx, tdev);
fz_drop_device (state.ctx, tdev);
for (j = 0; j < text->len; ++j) {
@ -2697,11 +2692,9 @@ static struct annot *getannot (struct page *page, int x, int y)
if (pdf) {
for (i = 0; i < page->annotcount; ++i) {
struct annot *a = &page->annots[i];
fz_rect rect;
fz_bound_annot (state.ctx, a->annot, &rect);
if (p.x >= rect.x0 && p.x <= rect.x1) {
if (p.y >= rect.y0 && p.y <= rect.y1) {
pdf_annot *annot = (pdf_annot *) a->annot;
if (p.x >= annot->pagerect.x0 && p.x <= annot->pagerect.x1) {
if (p.y >= annot->pagerect.y0 && p.y <= annot->pagerect.y1) {
return a;
}
}
@ -2753,7 +2746,6 @@ static void ensuretext (struct page *page)
tdev, &ctm, &fz_infinite_rect, NULL);
qsort (page->text->blocks, page->text->len,
sizeof (*page->text->blocks), compareblocks);
fz_close_device (state.ctx, tdev);
fz_drop_device (state.ctx, tdev);
}
}
@ -3899,7 +3891,6 @@ CAMLprim value ml_getpagebox (value opaque_v)
ctm = pagectm (page);
fz_run_page (state.ctx, page->fzpage, dev, &ctm, NULL);
fz_close_device (state.ctx, dev);
fz_drop_device (state.ctx, dev);
fz_round_rect (&bbox, &rect);
Field (ret_v, 0) = Val_int (bbox.x0);