Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cpsoutput.cpp
Go to the documentation of this file.
1
// Copyright 2016 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/win32/cpsoutput.h"
8
9
#
include
<
algorithm
>
10
11
#
include
"core/fxcrt/compiler_specific.h"
12
#
include
"core/fxcrt/fx_memcpy_wrappers.h"
13
#
include
"core/fxcrt/fx_system.h"
14
#
include
"core/fxcrt/span.h"
15
16
CPSOutput::
CPSOutput
(HDC hDC,
OutputMode
mode) :
m_hDC
(
hDC
), m_mode(mode) {}
17
18
CPSOutput::~
CPSOutput
() =
default
;
19
20
bool
CPSOutput::
WriteBlock
(pdfium::span<
const
uint8_t> input) {
21
while
(!input.empty()) {
22
uint8_t buffer[1026];
23
size_t send_len = std::min<size_t>(input.size(), 1024);
24
*(
reinterpret_cast
<uint16_t*>(buffer)) =
static_cast
<uint16_t>(send_len);
25
UNSAFE_TODO
(FXSYS_memcpy(buffer + 2, input.data(), send_len));
26
switch
(m_mode) {
27
case
OutputMode
::
kExtEscape
:
28
ExtEscape(m_hDC, PASSTHROUGH,
static_cast
<
int
>(send_len + 2),
29
reinterpret_cast
<
const
char
*>(buffer), 0,
nullptr
);
30
break
;
31
case
OutputMode
::
kGdiComment
:
32
GdiComment(m_hDC,
static_cast
<UINT>(send_len + 2), buffer);
33
break
;
34
}
35
input = input.subspan(send_len);
36
}
37
return
true
;
38
}
CPSOutput::WriteBlock
bool WriteBlock(pdfium::span< const uint8_t > input) override
Definition
cpsoutput.cpp:20
CPSOutput::~CPSOutput
~CPSOutput() override
CPSOutput::CPSOutput
CPSOutput(HDC hDC, OutputMode mode)
Definition
cpsoutput.cpp:16
CPSOutput::OutputMode
OutputMode
Definition
cpsoutput.h:17
CPSOutput::OutputMode::kExtEscape
@ kExtEscape
Definition
cpsoutput.h:17
CPSOutput::OutputMode::kGdiComment
@ kGdiComment
Definition
cpsoutput.h:17
UNSAFE_TODO
#define UNSAFE_TODO(...)
Definition
compiler_specific.h:102
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxge
win32
cpsoutput.cpp
Generated on
for Qt by
1.18.0