From e1b7bbbc0af7c2c0cf8e1286e80f7fbbe1c4c49f Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sat, 14 Oct 2017 07:48:11 +1030 Subject: [PATCH] cairo: use custom downscaling for scaling < 0.5 --- poppler/CairoOutputDev.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 80f7a99e..77183009 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -3085,7 +3085,16 @@ public: bool needsCustomDownscaling = true; #endif - if (!needsCustomDownscaling || printing || scaledWidth >= width || scaledHeight >= height) { + bool useCustomDownscaling = false; + if (!printing) { + if (needsCustomDownscaling && scaledWidth < width && scaledHeight < height) + useCustomDownscaling = true; + + if (width/scaledWidth > 2 || height/scaledHeight > 2) + useCustomDownscaling = true; + } + + if (!useCustomDownscaling) { // No downscaling. Create cairo image containing the source image data. unsigned char *buffer; int stride; -- 2.11.0