Kaydet (Commit) 0ac4425e authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

tdf#123420 Fix RGB/BGR issue with PNG reader

Change-Id: I4c6ffc89a21f46dea8775d4ec9aacc4f7ca71d94
Reviewed-on: https://gerrit.libreoffice.org/67764
Tested-by: Jenkins
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst f637b79e
......@@ -88,8 +88,6 @@ bool reader(SvStream& rStream, BitmapEx& rBitmapEx)
Bitmap aBitmap(Size(width, height), 24);
AlphaMask aBitmapAlpha(Size(width, height), nullptr);
png_set_bgr(pPng);
if (colorType == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb(pPng);
......@@ -138,6 +136,9 @@ bool reader(SvStream& rStream, BitmapEx& rBitmapEx)
size_t aRowSizeBytes = png_get_rowbytes(pPng, pInfo);
BitmapScopedWriteAccess pWriteAccess(aBitmap);
ScanlineFormat eFromat = pWriteAccess->GetScanlineFormat();
if (eFromat == ScanlineFormat::N24BitTcBgr)
png_set_bgr(pPng);
std::vector<png_byte> aRow(aRowSizeBytes, 0);
......@@ -165,6 +166,10 @@ bool reader(SvStream& rStream, BitmapEx& rBitmapEx)
BitmapScopedWriteAccess pWriteAccess(aBitmap);
AlphaScopedWriteAccess pWriteAccessAlpha(aBitmapAlpha);
ScanlineFormat eFromat = pWriteAccess->GetScanlineFormat();
if (eFromat == ScanlineFormat::N24BitTcBgr)
png_set_bgr(pPng);
std::vector<png_byte> aRow(aRowSizeBytes, 0);
for (int pass = 0; pass < nNumberOfPasses; pass++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment