summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2018-07-10 16:54:17 +0200
committerSzabolcs David <davidsz@inf.u-szeged.hu>2018-07-18 14:47:02 +0000
commit46dcf12a19286b393ce017728fdade70c45947a8 (patch)
treeb371678bc634ccebb5f25cabfab072659f40bab9
parent9f87e980ccacd099e3a4f4edcf5f4ae62eb56493 (diff)
downloadqtwebengine-chromium-46dcf12a19286b393ce017728fdade70c45947a8.tar.gz
Enable high resolution printing
PDFium silently terminates when the buffer size of the currently printed bitmap cannot be represented on 30 bits. HighResolution mode of QPrinter tries to render in 1200 DPI, which means it will over exceed this limit. Using the maximum buffer size possible enables this printing mode for WebEngine. Task-number: QTBUG-68965 Change-Id: I5dd4250fdc5026d914c8673d9d9cc5e5a6357a2f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.cpp7
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.cpp b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.cpp
index 9fa9776df0d..39afef63353 100644
--- a/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.cpp
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.cpp
@@ -42,7 +42,7 @@ bool CFX_DIBitmap::Create(int width,
m_Height = 0;
m_Pitch = 0;
- uint32_t calculatedSize;
+ size_t calculatedSize;
if (!CFX_DIBitmap::CalculatePitchAndSize(height, width, format, &pitch,
&calculatedSize))
return false;
@@ -815,7 +815,7 @@ bool CFX_DIBitmap::CalculatePitchAndSize(int height,
int width,
FXDIB_Format format,
uint32_t* pitch,
- uint32_t* size) {
+ size_t* size) {
if (width <= 0 || height <= 0)
return false;
@@ -829,7 +829,8 @@ bool CFX_DIBitmap::CalculatePitchAndSize(int height,
if (!*pitch)
*pitch = static_cast<uint32_t>((width * bpp + 31) / 32 * 4);
- if ((1 << 30) / *pitch < static_cast<uint32_t>(height))
+ // The final size of the buffer will be (*size + 4). We are trying to not exceed this.
+ if ((std::numeric_limits<std::size_t>::max() - 4) / *pitch < static_cast<uint32_t>(height))
return false;
*size = *pitch * static_cast<uint32_t>(height);
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.h b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.h
index 00a145af68e..acd177002ef 100644
--- a/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.h
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.h
@@ -99,7 +99,7 @@ class CFX_DIBitmap : public CFX_DIBSource {
int width,
FXDIB_Format format,
uint32_t* pitch,
- uint32_t* size);
+ size_t* size);
#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_
void PreMultiply();