summaryrefslogtreecommitdiff
path: root/office/fbpdf/mupdf-1.7a.diff
blob: b51d4141c3d4dc43fed72b72b89193271b2cd1b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
diff -Naur fbpdf-20140822/mupdf.c fbpdf-20140822.patched/mupdf.c
--- fbpdf-20140822/mupdf.c	2014-08-21 21:12:00.000000000 -0400
+++ fbpdf-20140822.patched/mupdf.c	2015-09-12 03:24:40.000000000 -0400
@@ -23,11 +23,11 @@
 	int h, w;
 	int x, y;
 
-	if (!(page = fz_load_page(doc->pdf, p - 1)))
+	if (!(page = fz_load_page(doc->ctx, doc->pdf, p - 1)))
 		return 1;
 	fz_rotate(&ctm, rotate);
 	fz_pre_scale(&ctm, (float) zoom / 10, (float) zoom / 10);
-	fz_bound_page(doc->pdf, page, &rect);
+	fz_bound_page(doc->ctx, page, &rect);
 	fz_transform_rect(&rect, &ctm);
 	fz_round_rect(&bbox, &rect);
 	w = MIN_(*cols, rect.x1 - rect.x0);
@@ -37,8 +37,8 @@
 	fz_clear_pixmap_with_value(doc->ctx, pix, 0xff);
 
 	dev = fz_new_draw_device(doc->ctx, pix);
-	fz_run_page(doc->pdf, page, dev, &ctm, NULL);
-	fz_free_device(dev);
+	fz_run_page(doc->ctx, page, dev, &ctm, NULL);
+	fz_drop_device(doc->ctx, dev);
 
 	for (y = 0; y < h; y++) {
 		int xs = y * *cols + (*cols - w) / 2;
@@ -50,7 +50,7 @@
 		}
 	}
 	fz_drop_pixmap(doc->ctx, pix);
-	fz_free_page(doc->pdf, page);
+	fz_drop_page(doc->ctx, page);
 	*cols = w;
 	*rows = h;
 	return 0;
@@ -58,7 +58,7 @@
 
 int doc_pages(struct doc *doc)
 {
-	return fz_count_pages(doc->pdf);
+	return fz_count_pages(doc->ctx, doc->pdf);
 }
 
 struct doc *doc_open(char *path)
@@ -69,7 +69,7 @@
 	fz_try (doc->ctx) {
 		doc->pdf = fz_open_document(doc->ctx, path);
 	} fz_catch (doc->ctx) {
-		fz_free_context(doc->ctx);
+		fz_drop_context(doc->ctx);
 		free(doc);
 		return NULL;
 	}
@@ -78,7 +78,7 @@
 
 void doc_close(struct doc *doc)
 {
-	fz_close_document(doc->pdf);
-	fz_free_context(doc->ctx);
+	fz_drop_document(doc->ctx, doc->pdf);
+	fz_drop_context(doc->ctx);
 	free(doc);
 }