xmlsecurity/workben/pdfverify.cxx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
New commits: commit f9b32576553b2972194510cc808d12fe198bc8c8 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Feb 10 10:48:41 2017 +0100 pdfverify preview: fix macOS color space Unlike on Linux and Windows, we need to do an ARGB -> BGRA conversion here. Change-Id: Ifa539973de439de25125e544cfbbe941d08dee00 diff --git a/xmlsecurity/workben/pdfverify.cxx b/xmlsecurity/workben/pdfverify.cxx index dceb863..d481d15 100644 --- a/xmlsecurity/workben/pdfverify.cxx +++ b/xmlsecurity/workben/pdfverify.cxx @@ -85,11 +85,28 @@ void generatePreview(const OString& rPdfPath, const OString& rPngPath) Bitmap aBitmap(Size(nPageWidth, nPageHeight), 32); { Bitmap::ScopedWriteAccess pWriteAccess(aBitmap); - const void* pPdfBuffer = FPDFBitmap_GetBuffer(pPdfBitmap); + const char* pPdfBuffer = static_cast<const char*>(FPDFBitmap_GetBuffer(pPdfBitmap)); +#ifndef MACOSX std::memcpy(pWriteAccess->GetBuffer(), pPdfBuffer, nPageWidth * nPageHeight * 4); +#else + // ARGB -> BGRA + for (int nRow = 0; nRow < nPageHeight; ++nRow) + { + int nStride = FPDFBitmap_GetStride(pPdfBitmap); + const char* pPdfLine = pPdfBuffer + (nStride * nRow); + Scanline pRow = pWriteAccess->GetBuffer() + (nPageWidth * nRow * 4); + for (int nCol = 0; nCol < nPageWidth; ++nCol) + { + pRow[nCol * 4] = pPdfLine[(nCol * 4) + 3]; + pRow[(nCol * 4) + 1] = pPdfLine[(nCol * 4) + 2]; + pRow[(nCol * 4) + 2] = pPdfLine[(nCol * 4) + 1]; + pRow[(nCol * 4) + 3] = pPdfLine[nCol * 4]; + } + } +#endif } BitmapEx aBitmapEx(aBitmap); -#ifdef WNT +#if defined(WNT) || defined(MACOSX) aBitmapEx.Mirror(BmpMirrorFlags::Vertical); #endif vcl::PNGWriter aWriter(aBitmapEx); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits