| Index: fpdfsdk/fpdfview.cpp
|
| diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
|
| index c292384e88ba5f42ae4e7ca4c1827da5a46089bd..15c4b003275eb0a9c6e3358e8d537b758c135357 100644
|
| --- a/fpdfsdk/fpdfview.cpp
|
| +++ b/fpdfsdk/fpdfview.cpp
|
| @@ -82,6 +82,10 @@ void RenderPageImpl(CPDF_PageRenderContext* pContext,
|
| if (flags & FPDF_RENDER_NO_SMOOTHPATH)
|
| pContext->m_pOptions->m_Flags |= RENDER_NOPATHSMOOTH;
|
| #endif // PDF_ENABLE_XFA
|
| +#ifdef _WIN32
|
| + if (flags & FPDF_COMPRESS_IMAGES)
|
| + pContext->m_pOptions->m_Flags |= RENDER_COMPRESS_IMAGES;
|
| +#endif
|
|
|
| // Grayscale output
|
| if (flags & FPDF_GRAYSCALE) {
|
| @@ -642,6 +646,7 @@ DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page) {
|
| #if defined(_WIN32)
|
| DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
|
| FPDF_PAGE page,
|
| + int driver_type,
|
| int start_x,
|
| int start_y,
|
| int size_x,
|
| @@ -656,6 +661,9 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
|
| pPage->SetRenderContext(pdfium::WrapUnique(pContext));
|
|
|
| std::unique_ptr<CFX_DIBitmap> pBitmap;
|
| + // TODO: This results in unnecessary rasterization of some PDFs due to
|
| + // HasImageMask() returning true. If any image on the page is a mask, the
|
| + // entire page gets rasterized and the spool size gets huge.
|
| const bool bNewBitmap =
|
| pPage->BackgroundAlphaNeeded() || pPage->HasImageMask();
|
| if (bNewBitmap) {
|
| @@ -666,14 +674,15 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
|
| pContext->m_pDevice = pdfium::WrapUnique(pDevice);
|
| pDevice->Attach(pBitmap.get(), false, nullptr, false);
|
| } else {
|
| - pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
|
| + pContext->m_pDevice =
|
| + pdfium::MakeUnique<CFX_WindowsDevice>(dc, driver_type);
|
| }
|
|
|
| FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
|
| rotate, flags, true, nullptr);
|
|
|
| if (bNewBitmap) {
|
| - CFX_WindowsDevice WinDC(dc);
|
| + CFX_WindowsDevice WinDC(dc, driver_type);
|
| if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) {
|
| std::unique_ptr<CFX_DIBitmap> pDst = pdfium::MakeUnique<CFX_DIBitmap>();
|
| int pitch = pBitmap->GetPitch();
|
|
|