vcl/source/filter/png/PngImageReader.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
New commits: commit 0ac4425e1c0c6b5c55933307929fc8d37a927b2c Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Feb 13 11:40:45 2019 +0100 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Wed Feb 13 14:42:35 2019 +0100 tdf#123420 Fix RGB/BGR issue with PNG reader Change-Id: I4c6ffc89a21f46dea8775d4ec9aacc4f7ca71d94 Reviewed-on: https://gerrit.libreoffice.org/67764 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/vcl/source/filter/png/PngImageReader.cxx b/vcl/source/filter/png/PngImageReader.cxx index 790336654714..b4778fe5df63 100644 --- a/vcl/source/filter/png/PngImageReader.cxx +++ b/vcl/source/filter/png/PngImageReader.cxx @@ -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++) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits