Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use float type for zoom #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion djvulibre.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
8 changes: 4 additions & 4 deletions fbpdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion mupdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion poppler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down