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

New commits:
commit 891ff1334eb4288668ebf70636d7972af691fa88
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Thu May 12 13:35:22 2022 +0200
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Thu May 12 19:30:15 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>

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

Reply via email to