From f29c3a4f96a740a5deb9119c236f710c559aa297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20A=CC=81ngel=20San=20Marti=CC=81n=20Rodri=CC=81guez?= Date: Thu, 20 Jun 2024 17:12:03 +0200 Subject: [PATCH] BUMP minimum render size for PDF pages --- CHANGELOG.md | 1 + common/pdf_comic.cpp | 11 ++++++++--- common/pdf_comic.mm | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 046df566..acd33cc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Version counting is based on semantic versioning (Major.Feature.Patch) ### YACReader * Save magnifying glass size and zoom level. * Add shortcut to reset the magnifying glass to its defaults (size and zoom), it is `slash` by default but it can be reasigned. +* Bump PDF render size. ### * Fix headers in the table view getting stuck in a non moveable state. diff --git a/common/pdf_comic.cpp b/common/pdf_comic.cpp index f68fb15d..9cdcd41c 100644 --- a/common/pdf_comic.cpp +++ b/common/pdf_comic.cpp @@ -106,11 +106,16 @@ QImage PdfiumComic::getPage(const int page) } // TODO: make target DPI configurable + // TODO: max render size too QSize pagesize((FPDF_GetPageWidth(pdfpage) / 72) * 150, (FPDF_GetPageHeight(pdfpage) / 72) * 150); - // TODO: max render size too - if (pagesize.width() > 3840 || pagesize.height() > 3840) { - pagesize.scale(3840, 3840, Qt::KeepAspectRatio); + auto maxSize = 4096; + if (pagesize.width() > maxSize || pagesize.height() > maxSize) { + pagesize.scale(maxSize, maxSize, Qt::KeepAspectRatio); + } + auto minSize = 2560; + if (pagesize.width() < minSize || pagesize.height() < minSize) { + pagesize.scale(minSize, minSize, Qt::KeepAspectRatio); } image = QImage(pagesize, QImage::Format_ARGB32); // QImage::Format_RGBX8888); if (image.isNull()) { diff --git a/common/pdf_comic.mm b/common/pdf_comic.mm index 18d3571b..9f671cb3 100644 --- a/common/pdf_comic.mm +++ b/common/pdf_comic.mm @@ -55,7 +55,7 @@ QImage MacOSXPDFComic::getPage(const int pageNum) // CGPDFPageRef page = [self getPage:page_number]; CGRect pageRect = CGPDFPageGetBoxRect(page, kCGPDFMediaBox); - int width = 1200; + int width = 2560; // NSLog(@"-----%f",pageRect.size.width); CGFloat pdfScale = float(width) / pageRect.size.width;