From bb740120d453a82566dbce64f11f1cd7318ff3c0 Mon Sep 17 00:00:00 2001 From: Nicolas Caramelli Date: Fri, 12 Jun 2020 08:37:42 +0200 Subject: [PATCH] use float type for zoom --- djvulibre.c | 2 +- doc.h | 2 +- fbpdf.c | 8 ++++---- mupdf.c | 2 +- poppler.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/djvulibre.c b/djvulibre.c index eced170..79eb7dd 100644 --- a/djvulibre.c +++ b/djvulibre.c @@ -42,7 +42,7 @@ static void djvu_render(ddjvu_page_t *page, int iw, int ih, void *bitmap) ddjvu_format_release(fmt); } -void *doc_draw(struct doc *doc, int p, int zoom, int rotate, int *rows, int *cols) +void *doc_draw(struct doc *doc, int p, float zoom, int rotate, int *rows, int *cols) { ddjvu_page_t *page; ddjvu_pageinfo_t info; diff --git a/doc.h b/doc.h index 6a1fa55..c646f5b 100644 --- a/doc.h +++ b/doc.h @@ -6,5 +6,5 @@ typedef unsigned int fbval_t; struct doc *doc_open(char *path); int doc_pages(struct doc *doc); -void *doc_draw(struct doc *doc, int page, int zoom, int rotate, int *rows, int *cols); +void *doc_draw(struct doc *doc, int page, float zoom, int rotate, int *rows, int *cols); void doc_close(struct doc *doc); diff --git a/fbpdf.c b/fbpdf.c index 65b654b..d660570 100644 --- a/fbpdf.c +++ b/fbpdf.c @@ -47,7 +47,7 @@ static int mark[128]; /* mark page number */ static int mark_row[128]; /* mark head position */ static int num = 1; /* page number */ static int numdiff; /* G command page number difference */ -static int zoom = 15; +static float zoom = 15; static int zoom_def = 15; /* default zoom */ static int rotate; static int count; @@ -89,9 +89,9 @@ static int loadpage(int p) return 0; } -static void zoom_page(int z) +static void zoom_page(float z) { - int _zoom = zoom; + float _zoom = zoom; zoom = MIN(MAXZOOM, MAX(1, z)); if (!loadpage(num)) srow = srow * zoom / _zoom; @@ -136,7 +136,7 @@ static int getcount(int def) static void printinfo(void) { printf("\x1b[H"); - printf("FBPDF: file:%s page:%d(%d) zoom:%d%% \x1b[K\r", + printf("FBPDF: file:%s page:%d(%d) zoom:%f%% \x1b[K\r", filename, num, doc_pages(doc), zoom * 10); fflush(stdout); } diff --git a/mupdf.c b/mupdf.c index 52640a1..7383029 100644 --- a/mupdf.c +++ b/mupdf.c @@ -11,7 +11,7 @@ struct doc { fz_document *pdf; }; -void *doc_draw(struct doc *doc, int p, int zoom, int rotate, int *rows, int *cols) +void *doc_draw(struct doc *doc, int p, float zoom, int rotate, int *rows, int *cols) { fz_matrix ctm; fz_pixmap *pix; diff --git a/poppler.c b/poppler.c index fdd646a..3fcb25e 100644 --- a/poppler.c +++ b/poppler.c @@ -27,7 +27,7 @@ static poppler::rotation_enum rotation(int times) return poppler::rotate_0; } -void *doc_draw(struct doc *doc, int p, int zoom, int rotate, int *rows, int *cols) +void *doc_draw(struct doc *doc, int p, float zoom, int rotate, int *rows, int *cols) { poppler::page *page = doc->doc->create_page(p - 1); poppler::page_renderer pr;