summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-02-03 12:36:09 +0000
committerMichael Stahl <mstahl@redhat.com>2016-02-04 13:49:26 +0000
commitfdf698bef5bf25c2a10e2b8ddb1955143cd3f227 (patch)
tree118d09b82edafd9766bfb0665937f17e11d36c13
parentf0649d4a752a1fbdf69c38740ac05c5219609f49 (diff)
Resolves: tdf#96653 distorted images on export to pdf
regression from: commit ffe150ce903d9cdc62c25ad3437e61d24ede17d6 Date: Fri Dec 4 18:19:08 2015 +0100 tdf#94739 use GetScanlineSize instead of calculating it which was on the right track in the sense that the original code was wrong and only worked for <= 8 bit depth images Change-Id: Iee54a9f29dd0fdaf3e1f2aeb7b9898cecb453e37 (cherry picked from commit 384c815eda697d75706f686dc2ceb227b4d3f245) Reviewed-on: https://gerrit.libreoffice.org/22074 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 7b82e0190340..6051b9c97436 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -11420,7 +11420,8 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
beginCompression();
if( ! bTrueColor || pAccess->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB )
{
- const int nScanLineBytes = pAccess->GetScanlineSize();
+ //With PDF bitmaps, each row is padded to a BYTE boundary (multiple of 8 bits).
+ const int nScanLineBytes = ((pAccess->GetBitCount() * pAccess->Width()) + 7U) / 8U;
for( long i = 0; i < pAccess->Height(); i++ )
{