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
bmp_decoder.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/fxcodec/bmp/bmp_decoder.h"
8
9
#
include
<
utility
>
10
11
#
include
"core/fxcodec/bmp/cfx_bmpcontext.h"
12
#
include
"core/fxcodec/cfx_codec_memory.h"
13
#
include
"core/fxcodec/fx_codec.h"
14
#
include
"core/fxcodec/fx_codec_def.h"
15
#
include
"core/fxcrt/check.h"
16
17
namespace
fxcodec
{
18
19
// static
20
std::unique_ptr<ProgressiveDecoderIface::Context>
BmpDecoder
::StartDecode(
21
Delegate
* pDelegate) {
22
return
std
::make_unique<CFX_BmpContext>(pDelegate);
23
}
24
25
// static
26
BmpDecoder
::
Status
BmpDecoder
::ReadHeader(
27
ProgressiveDecoderIface
::
Context
* pContext,
28
int32_t* width,
29
int32_t* height,
30
bool
* tb_flag,
31
int32_t* components,
32
pdfium::span<
const
FX_ARGB>* palette,
33
CFX_DIBAttribute* pAttribute) {
34
DCHECK
(pAttribute);
35
36
auto
* ctx =
static_cast
<CFX_BmpContext*>(pContext);
37
Status
status = ctx->m_Bmp.ReadHeader();
38
if
(status !=
Status
::
kSuccess
)
39
return
status;
40
41
*width = ctx->m_Bmp.width();
42
*height = ctx->m_Bmp.height();
43
*tb_flag = ctx->m_Bmp.img_tb_flag();
44
*components = ctx->m_Bmp.components();
45
*palette = ctx->m_Bmp.palette();
46
pAttribute->m_wDPIUnit = CFX_DIBAttribute::kResUnitMeter;
47
pAttribute->m_nXDPI = ctx->m_Bmp.dpi_x();
48
pAttribute->m_nYDPI = ctx->m_Bmp.dpi_y();
49
return
Status
::
kSuccess
;
50
}
51
52
// static
53
BmpDecoder
::
Status
BmpDecoder
::
LoadImage
(
54
ProgressiveDecoderIface
::
Context
* pContext) {
55
return
static_cast
<CFX_BmpContext*>(pContext)->m_Bmp.DecodeImage();
56
}
57
58
// static
59
FX_FILESIZE
BmpDecoder
::
GetAvailInput
(
60
ProgressiveDecoderIface
::
Context
* pContext) {
61
return
static_cast
<CFX_BmpContext*>(pContext)->m_Bmp.GetAvailInput();
62
}
63
64
// static
65
bool
BmpDecoder
::
Input
(
ProgressiveDecoderIface
::
Context
* pContext,
66
RetainPtr
<CFX_CodecMemory> codec_memory) {
67
auto
* ctx =
static_cast
<CFX_BmpContext*>(pContext);
68
ctx->m_Bmp.SetInputBuffer(
std
::move(codec_memory));
69
return
true
;
70
}
71
72
}
// namespace fxcodec
DCHECK
#define DCHECK
Definition
check.h:33
fxcodec::BmpDecoder::Delegate
Definition
bmp_decoder.h:28
fxcodec::BmpDecoder
Definition
bmp_decoder.h:26
fxcodec::BmpDecoder::Status
Status
Definition
bmp_decoder.h:35
fxcodec::BmpDecoder::Status::kSuccess
@ kSuccess
Definition
bmp_decoder.h:35
fxcodec::BmpDecoder::Input
static bool Input(ProgressiveDecoderIface::Context *pContext, RetainPtr< CFX_CodecMemory > codec_memory)
Definition
bmp_decoder.cpp:65
fxcodec::BmpDecoder::LoadImage
static Status LoadImage(ProgressiveDecoderIface::Context *pContext)
Definition
bmp_decoder.cpp:53
fxcodec::BmpDecoder::GetAvailInput
static FX_FILESIZE GetAvailInput(ProgressiveDecoderIface::Context *pContext)
Definition
bmp_decoder.cpp:59
fxcodec::ProgressiveDecoderIface::Context
Definition
progressive_decoder_iface.h:23
fxcodec::ProgressiveDecoderIface
Definition
progressive_decoder_iface.h:21
fxcrt::RetainPtr
Definition
retain_ptr.h:28
FX_FILESIZE
#define FX_FILESIZE
Definition
fx_types.h:19
fxcodec
Definition
fpdf_parser_decode.h:28
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcodec
bmp
bmp_decoder.cpp
Generated on
for Qt by
1.18.0