summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-28 19:41:32 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-03-29 10:12:46 +0200
commite82f0dc35e9acc9aefb18e267dca5b581828497c (patch)
tree8126ddba31a6ba803e13f860b7c7e4112c92aaac /vcl/source
parentbb79264cda2f182b71ccdfa9334896b594b2eb67 (diff)
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@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/filter/png/PngImageReader.cxx19
1 files changed, 10 insertions, 9 deletions
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;