[Libreoffice-commits] core.git: vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Mar 29 08:13:27 UTC 2021
vcl/source/filter/png/PngImageReader.cxx | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
New commits:
commit e82f0dc35e9acc9aefb18e267dca5b581828497c
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Mar 28 19:41:32 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Mar 29 10:12:46 2021 +0200
UseBitmap32 isn't active in the headless backend
so this isn't currently being used.
This reverts commit 31913141d2bcc3b3a8bfb6d018fbf142bd81bf58.
Change-Id: I46f285a53b50bfc53c059514f3499f50d3b28e6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113260
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/source/filter/png/PngImageReader.cxx b/vcl/source/filter/png/PngImageReader.cxx
index fc60884f42c8..c7ff5a9a8990 100644
--- a/vcl/source/filter/png/PngImageReader.cxx
+++ b/vcl/source/filter/png/PngImageReader.cxx
@@ -235,6 +235,10 @@ bool reader(SvStream& rStream, BitmapEx& rBitmapEx, bool bUseBitmap32)
png_set_bgr(pPng);
}
+ aRows = std::vector<std::vector<png_byte>>(height);
+ for (auto& rRow : aRows)
+ rRow.resize(aRowSizeBytes, 0);
+
auto const alphaFirst = (eFormat == ScanlineFormat::N32BitTcAbgr
|| eFormat == ScanlineFormat::N32BitTcArgb);
for (int pass = 0; pass < nNumberOfPasses; pass++)
@@ -242,22 +246,19 @@ bool reader(SvStream& rStream, BitmapEx& rBitmapEx, bool bUseBitmap32)
for (png_uint_32 y = 0; y < height; y++)
{
Scanline pScanline = pWriteAccess->GetScanline(y);
- png_read_row(pPng, pScanline, nullptr);
+ png_bytep pRow = aRows[y].data();
+ png_read_row(pPng, pRow, nullptr);
size_t iColor = 0;
for (size_t i = 0; i < aRowSizeBytes; i += 4)
{
- sal_uInt8 alpha = pScanline[i + 3];
- sal_uInt8 byte1 = vcl::bitmap::premultiply(pScanline[i + 0], alpha);
- sal_uInt8 byte2 = vcl::bitmap::premultiply(pScanline[i + 1], alpha);
- sal_uInt8 byte3 = vcl::bitmap::premultiply(pScanline[i + 2], alpha);
-
+ sal_Int8 alpha = pRow[i + 3];
if (alphaFirst)
{
pScanline[iColor++] = alpha;
}
- pScanline[iColor++] = byte1;
- pScanline[iColor++] = byte2;
- pScanline[iColor++] = byte3;
+ pScanline[iColor++] = vcl::bitmap::premultiply(pRow[i + 0], alpha);
+ pScanline[iColor++] = vcl::bitmap::premultiply(pRow[i + 1], alpha);
+ pScanline[iColor++] = vcl::bitmap::premultiply(pRow[i + 2], alpha);
if (!alphaFirst)
{
pScanline[iColor++] = alpha;
More information about the Libreoffice-commits
mailing list