summaryrefslogtreecommitdiff
path: root/vcl/source/bitmap/salbmp.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2025-01-22 20:12:41 +0200
committerNoel Grandin <noelgrandin@gmail.com>2025-01-23 08:28:14 +0100
commit18df81e1568f4944a8fd79fd81e85d263dc0325b (patch)
tree78b09ab5085257cc33f6f99605f6369271ef9b75 /vcl/source/bitmap/salbmp.cxx
parente4271c596d33b2e864e86517a15694967f05fa33 (diff)
Revert "ScanlineDirection is unnecessary"
This reverts commit a525438eb62f59801899c5ea45e451963b2ec248 Author: Noel Grandin <noelgrandin@collabora.co.uk> Date: Wed Jan 22 09:50:43 2025 +0200 fix GDI and Quartz backends and commit 828a0dcdf6fd1600baaf3103583633006a90d9f9 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Thu Jan 16 08:23:19 2025 +0200 ScanlineDirection is unnecessary because macOS uses bottom-up coordinate system, and I could not find a way to make the bitmaps stored top-down. Change-Id: Idc05b7473eca5fae0e33d634117de810146da3b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180603 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/bitmap/salbmp.cxx')
-rw-r--r--vcl/source/bitmap/salbmp.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/vcl/source/bitmap/salbmp.cxx b/vcl/source/bitmap/salbmp.cxx
index a84fc63f4042..3e8f0b255d2d 100644
--- a/vcl/source/bitmap/salbmp.cxx
+++ b/vcl/source/bitmap/salbmp.cxx
@@ -62,11 +62,19 @@ void SalBitmap::updateChecksum() const
break;
}
}
- if( pBuf->mnScanlineSize == lineBitsCount / 8 )
- nCrc = rtl_crc32(nCrc, pBuf->mpBits, pBuf->mnScanlineSize * pBuf->mnHeight);
- else // Do not include padding with undefined content in the checksum.
- for( tools::Long y = 0; y < pBuf->mnHeight; ++y )
+ if (pBuf->meDirection == ScanlineDirection::TopDown)
+ {
+ if( pBuf->mnScanlineSize == lineBitsCount / 8 )
+ nCrc = rtl_crc32(nCrc, pBuf->mpBits, pBuf->mnScanlineSize * pBuf->mnHeight);
+ else // Do not include padding with undefined content in the checksum.
+ for( tools::Long y = 0; y < pBuf->mnHeight; ++y )
+ nCrc = scanlineChecksum(nCrc, pBuf->mpBits + y * pBuf->mnScanlineSize, lineBitsCount, extraBitsMask);
+ }
+ else // Compute checksum in the order of scanlines, to make it consistent between different bitmap implementations.
+ {
+ for( tools::Long y = pBuf->mnHeight - 1; y >= 0; --y )
nCrc = scanlineChecksum(nCrc, pBuf->mpBits + y * pBuf->mnScanlineSize, lineBitsCount, extraBitsMask);
+ }
pThis->ReleaseBuffer(pBuf, BitmapAccessMode::Read);
pThis->mnChecksum = nCrc;
pThis->mbChecksumValid = true;