Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cfx_windowsrenderdevice.cpp
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "core/fxge/cfx_windowsrenderdevice.h"
8
9#include <memory>
10
11#include "core/fxge/renderdevicedriver_iface.h"
12#include "core/fxge/win32/cgdi_display_driver.h"
13#include "core/fxge/win32/cgdi_printer_driver.h"
14#include "core/fxge/win32/cps_printer_driver.h"
15#include "core/fxge/win32/ctext_only_printer_driver.h"
16
17namespace {
18
19std::unique_ptr<RenderDeviceDriverIface> CreateDriver(
20 HDC hDC,
21 CFX_PSFontTracker* ps_font_tracker,
22 const EncoderIface* encoder_iface) {
23 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY);
24 int obj_type = ::GetObjectType(hDC);
25 bool use_printer = device_type == DT_RASPRINTER ||
26 device_type == DT_PLOTTER ||
27 device_type == DT_CHARSTREAM || obj_type == OBJ_ENHMETADC;
28
29 if (!use_printer)
30 return std::make_unique<CGdiDisplayDriver>(hDC);
31
34 return std::make_unique<CGdiPrinterDriver>(hDC);
35 }
36
38 return std::make_unique<CTextOnlyPrinterDriver>(hDC);
39
40 return std::make_unique<CPSPrinterDriver>(hDC, g_pdfium_print_mode,
41 ps_font_tracker, encoder_iface);
42}
43
44} // namespace
45
47
49 HDC hDC,
50 CFX_PSFontTracker* ps_font_tracker,
51 const EncoderIface* encoder_iface) {
52 SetDeviceDriver(CreateDriver(hDC, ps_font_tracker, encoder_iface));
53}
54
WindowsPrintMode g_pdfium_print_mode
CFX_WindowsRenderDevice(HDC hDC, CFX_PSFontTracker *ps_font_tracker, const EncoderIface *encoder_iface)
~CFX_WindowsRenderDevice() override