summaryrefslogtreecommitdiff
path: root/core/fxge/win32
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge/win32')
-rw-r--r--core/fxge/win32/cpsoutput.cpp13
-rw-r--r--core/fxge/win32/cpsoutput.h5
-rw-r--r--core/fxge/win32/fx_win32_print.cpp18
3 files changed, 27 insertions, 9 deletions
diff --git a/core/fxge/win32/cpsoutput.cpp b/core/fxge/win32/cpsoutput.cpp
index 83f2fc09c6..5c734aa57a 100644
--- a/core/fxge/win32/cpsoutput.cpp
+++ b/core/fxge/win32/cpsoutput.cpp
@@ -10,7 +10,7 @@
#include "core/fxcrt/fx_system.h"
-CPSOutput::CPSOutput(HDC hDC) : m_hDC(hDC) {}
+CPSOutput::CPSOutput(HDC hDC, OutputMode mode) : m_hDC(hDC), m_mode(mode) {}
CPSOutput::~CPSOutput() {}
@@ -22,9 +22,14 @@ bool CPSOutput::WriteBlock(const void* str, size_t len) {
*(reinterpret_cast<uint16_t*>(buffer)) = send_len;
memcpy(buffer + 2, static_cast<const char*>(str) + sent_len, send_len);
- // TODO(thestig/rbpotter): Do PASSTHROUGH for non-Chromium usage.
- // ExtEscape(m_hDC, PASSTHROUGH, send_len + 2, buffer, 0, nullptr);
- ::GdiComment(m_hDC, send_len + 2, reinterpret_cast<const BYTE*>(buffer));
+ switch (m_mode) {
+ case OutputMode::kExtEscape:
+ ExtEscape(m_hDC, PASSTHROUGH, send_len + 2, buffer, 0, nullptr);
+ break;
+ case OutputMode::kGdiComment:
+ GdiComment(m_hDC, send_len + 2, reinterpret_cast<const BYTE*>(buffer));
+ break;
+ }
sent_len += send_len;
len -= send_len;
}
diff --git a/core/fxge/win32/cpsoutput.h b/core/fxge/win32/cpsoutput.h
index d140de95f4..49317a64a5 100644
--- a/core/fxge/win32/cpsoutput.h
+++ b/core/fxge/win32/cpsoutput.h
@@ -14,7 +14,9 @@
class CPSOutput : public IFX_WriteStream {
public:
- explicit CPSOutput(HDC hDC);
+ enum class OutputMode { kExtEscape, kGdiComment };
+
+ CPSOutput(HDC hDC, OutputMode mode);
~CPSOutput() override;
// IFX_Writestream
@@ -23,6 +25,7 @@ class CPSOutput : public IFX_WriteStream {
private:
HDC m_hDC;
+ const OutputMode m_mode;
};
#endif // CORE_FXGE_WIN32_CPSOUTPUT_H_
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index da40b8a762..f36fa84364 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -334,8 +334,18 @@ CPSPrinterDriver::CPSPrinterDriver(HDC hDC,
: m_hDC(hDC), m_bCmykOutput(bCmykOutput) {
// |mode| should be PostScript.
ASSERT(mode == WindowsPrintMode::kModePostScript2 ||
- mode == WindowsPrintMode::kModePostScript3);
- int pslevel = mode == WindowsPrintMode::kModePostScript2 ? 2 : 3;
+ mode == WindowsPrintMode::kModePostScript3 ||
+ mode == WindowsPrintMode::kModePostScript2PassThrough ||
+ mode == WindowsPrintMode::kModePostScript3PassThrough);
+ int pslevel = (mode == WindowsPrintMode::kModePostScript2 ||
+ mode == WindowsPrintMode::kModePostScript2PassThrough)
+ ? 2
+ : 3;
+ CPSOutput::OutputMode output_mode =
+ (mode == WindowsPrintMode::kModePostScript2 ||
+ mode == WindowsPrintMode::kModePostScript3)
+ ? CPSOutput::OutputMode::kGdiComment
+ : CPSOutput::OutputMode::kExtEscape;
m_HorzSize = ::GetDeviceCaps(m_hDC, HORZSIZE);
m_VertSize = ::GetDeviceCaps(m_hDC, VERTSIZE);
@@ -343,8 +353,8 @@ CPSPrinterDriver::CPSPrinterDriver(HDC hDC,
m_Height = ::GetDeviceCaps(m_hDC, VERTRES);
m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL);
- m_PSRenderer.Init(pdfium::MakeRetain<CPSOutput>(m_hDC), pslevel, m_Width,
- m_Height, bCmykOutput);
+ m_PSRenderer.Init(pdfium::MakeRetain<CPSOutput>(m_hDC, output_mode), pslevel,
+ m_Width, m_Height, bCmykOutput);
HRGN hRgn = ::CreateRectRgn(0, 0, 1, 1);
int ret = ::GetClipRgn(hDC, hRgn);
if (ret == 1) {