summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-01-20 17:53:25 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-01-21 12:24:20 +0100
commitb9896d177be27b9c91402e211cac05d6a8b35c2d (patch)
treec9a4f74cc22d77a161889c45475d4d73c477ae7f
parentec855fe33351d482b6d60fd92cf531757fccee83 (diff)
PDF export: skip pointless downsampling for very small images
Regression from commit b6588bd7c831ce88a29131ca7ea8d3f3e082564e (Reduce image resolution by default in PDF Export, 2014-03-02) the problem is that in case you have small enough bitmaps, then these used to look OK at reasonable zoom levels, but now we intentionally scale down bitmaps by default. That makes little sense for tiny images, do this only for large ones. (cherry picked from commit b894ec7fadb8ca6bf0b33fa9eee4b9303e8161d4) [ Testcase not backported, pdfium is too old on this branch. ] Conflicts: vcl/qa/cppunit/pdfexport/pdfexport.cxx vcl/source/gdi/pdfwriter_impl2.cxx Change-Id: Iff15325b842b47d9285a7c0f83f402897498392d
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index bf039f142d58..26cfe00c9b27 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -104,11 +104,13 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
bIsPng = (eType == GfxLinkType::NativePng);
}
- if( i_rContext.m_nMaxImageResolution > 50 )
+ // Do not downsample images smaller than 50x50px.
+ const Size aBmpSize( aBitmapEx.GetSizePixel() );
+ if (i_rContext.m_nMaxImageResolution > 50 && aBmpSize.getWidth() > 50
+ && aBmpSize.getHeight() > 50)
{
// do downsampling if necessary
const Size aDstSizeTwip( i_pDummyVDev->PixelToLogic( i_pDummyVDev->LogicToPixel( aSize ), MapUnit::MapTwip ) );
- const Size aBmpSize( aBitmapEx.GetSizePixel() );
const double fBmpPixelX = aBmpSize.Width();
const double fBmpPixelY = aBmpSize.Height();
const double fMaxPixelX = aDstSizeTwip.Width() * i_rContext.m_nMaxImageResolution / 1440.0;