diff options
Diffstat (limited to 'src/core/printing/pdfium_document_wrapper_qt.cpp')
-rw-r--r-- | src/core/printing/pdfium_document_wrapper_qt.cpp | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/core/printing/pdfium_document_wrapper_qt.cpp b/src/core/printing/pdfium_document_wrapper_qt.cpp index a7433b2cc..47c207a8a 100644 --- a/src/core/printing/pdfium_document_wrapper_qt.cpp +++ b/src/core/printing/pdfium_document_wrapper_qt.cpp @@ -36,11 +36,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "pdf/features.h" -#if BUILDFLAG(ENABLE_PDF) #include "pdfium_document_wrapper_qt.h" - #include <QtCore/qhash.h> #include <QtGui/qimage.h> #include <QtGui/qpainter.h> @@ -51,7 +48,7 @@ namespace QtWebEngineCore { int PdfiumDocumentWrapperQt::m_libraryUsers = 0; -class QWEBENGINE_EXPORT PdfiumPageWrapperQt { +class QWEBENGINECORE_PRIVATE_EXPORT PdfiumPageWrapperQt { public: PdfiumPageWrapperQt(void *data, int pageIndex, int targetWidth, int targetHeight) : m_pageData(FPDF_LoadPage(data, pageIndex)) @@ -91,7 +88,7 @@ private: if (targetHeight <= 0) targetHeight = m_height; - QImage image(targetWidth, targetHeight, QImage::Format_RGBA8888); + QImage image(targetWidth, targetHeight, QImage::Format_ARGB32); Q_ASSERT(!image.isNull()); image.fill(0xFFFFFFFF); @@ -105,16 +102,7 @@ private: 0, 0); FPDFBitmap_Destroy(bitmap); bitmap = nullptr; - - // Map BGRA to RGBA as PDFium currently does not support RGBA bitmaps directly - for (int i = 0; i < image.height(); i++) { - uchar *pixels = image.scanLine(i); - for (int j = 0; j < image.width(); j++) { - qSwap(pixels[0], pixels[2]); - pixels += 4; - } - } - return image; + return std::move(image); } private: @@ -165,4 +153,3 @@ PdfiumDocumentWrapperQt::~PdfiumDocumentWrapperQt() } } -#endif // BUILDFLAG(ENABLE_PDF) |