vcl/source/filter/itiff/itiff.cxx |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit cc6e2d409328f8e4d06305dde47cdc794945b4d8
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Thu May 12 13:35:22 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon May 16 10:39:56 2022 +0200

    tdf#119686: fix tiff with 1 bit per pixel
    
    On the 30 pixels width images, the 3 first bytes were ok,
    that's why the 24 first pixels of each line was ok.
    The pb was in the fourth byte, you must read each bit of this last byte
    until reaching 30 pixels, so 6 bits (since width 30 corresponds to 3 * 8 + 
(8 - 2)).
    Here LO always shifted this byte with the same value, so used the value of 
the first bit for the last 6 bits of the last byte.
    => just decrement the shift value at the end of each loop
    
    With this patch initial, attachment of the bugtracker 
https://bugs.documentfoundation.org/attachment.cgi?id=144656
    and the more complex one 
https://bugs.documentfoundation.org/attachment.cgi?id=144656 are ok
    
    Change-Id: I17339c54d6822c724184f167fb3a25b240e06543
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134235
    Tested-by: Julien Nabet <serval2...@yahoo.fr>
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134248
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/vcl/source/filter/itiff/itiff.cxx 
b/vcl/source/filter/itiff/itiff.cxx
index cad78f1b7d1f..5ce017dea9c7 100644
--- a/vcl/source/filter/itiff/itiff.cxx
+++ b/vcl/source/filter/itiff/itiff.cxx
@@ -1120,6 +1120,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
                             while ( nx < nImageWidth )
                             {
                                 SetPixel(nY, nx++, ( nByteVal >> nShift ) & 1);
+                                --nShift;
                             }
                         }
                     }

Reply via email to