[Libreoffice-commits] core.git: Branch 'libreoffice-5-0-5' - vcl/source

Caolán McNamara caolanm at redhat.com
Thu Feb 4 13:59:42 UTC 2016


 vcl/source/gdi/pdfwriter_impl.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 66c3261ed55735fd6ab927c310e214f43b1f5922
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 3 12:36:09 2016 +0000

    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/22077
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index e509b1a..f2974a2 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -11426,7 +11426,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( int i = 0; i < pAccess->Height(); i++ )
             {


More information about the Libreoffice-commits mailing list