From d5b9e3c95500c159a2dfc40657ab95da5f2777dd Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 30 Jan 2012 18:49:24 +0100 Subject: Use image DPI in CBZ parser. --- cbz/mucbz.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'cbz') diff --git a/cbz/mucbz.c b/cbz/mucbz.c index 4a633bcb..a91589cf 100644 --- a/cbz/mucbz.c +++ b/cbz/mucbz.c @@ -9,7 +9,7 @@ #define ZIP_CENTRAL_DIRECTORY_SIG 0x02014b50 #define ZIP_END_OF_CENTRAL_DIRECTORY_SIG 0x06054b50 -#define DPI (72.0f / 144.0f) +#define DPI 72.0f static const char *cbz_ext_list[] = { ".jpg", ".jpeg", ".png", @@ -395,8 +395,8 @@ cbz_bound_page(cbz_document *doc, cbz_page *page) fz_pixmap *image = page->image; fz_rect bbox; bbox.x0 = bbox.y0 = 0; - bbox.x1 = image->w * DPI; - bbox.y1 = image->h * DPI; + bbox.x1 = image->w * DPI / image->xres; + bbox.y1 = image->h * DPI / image->yres; return bbox; } @@ -404,6 +404,8 @@ void cbz_run_page(cbz_document *doc, cbz_page *page, fz_device *dev, fz_matrix ctm, fz_cookie *cookie) { fz_pixmap *image = page->image; - ctm = fz_concat(fz_scale(image->w * DPI, image->h * DPI), ctm); + float w = image->w * DPI / image->xres; + float h = image->h * DPI / image->yres; + ctm = fz_concat(fz_scale(w, h), ctm); fz_fill_image(dev, image, ctm, 1); } -- cgit v1.2.3