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
cfx_bmpdecompressor.h
Go to the documentation of this file.
1
// Copyright 2018 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
#
ifndef
CORE_FXCODEC_BMP_CFX_BMPDECOMPRESSOR_H_
8
#
define
CORE_FXCODEC_BMP_CFX_BMPDECOMPRESSOR_H_
9
10
#
include
<
stdint
.
h
>
11
12
#
include
<
vector
>
13
14
#
include
"core/fxcodec/bmp/bmp_decoder.h"
15
#
include
"core/fxcodec/bmp/fx_bmp.h"
16
#
include
"core/fxcrt/data_vector.h"
17
#
include
"core/fxcrt/retain_ptr.h"
18
#
include
"core/fxcrt/span.h"
19
#
include
"core/fxcrt/unowned_ptr.h"
20
#
include
"core/fxge/dib/fx_dib.h"
21
22
class
CFX_CodecMemory;
23
24
namespace
fxcodec
{
25
26
class
CFX_BmpContext;
27
28
class
CFX_BmpDecompressor
{
29
public
:
30
explicit
CFX_BmpDecompressor
(
const
CFX_BmpContext* context);
31
~
CFX_BmpDecompressor
();
32
33
BmpDecoder
::
Status
DecodeImage
();
34
BmpDecoder
::
Status
ReadHeader
();
35
void
SetInputBuffer
(
RetainPtr
<CFX_CodecMemory> codec_memory);
36
FX_FILESIZE
GetAvailInput
()
const
;
37
38
pdfium
::
span
<
const
FX_ARGB
>
palette
()
const
{
return
palette_; }
39
uint32_t
width
()
const
{
return
width_; }
40
uint32_t
height
()
const
{
return
height_; }
41
int32_t
components
()
const
{
return
components_; }
42
bool
img_tb_flag
()
const
{
return
img_tb_flag_; }
43
int32_t
dpi_x
()
const
{
return
dpi_x_; }
44
int32_t
dpi_y
()
const
{
return
dpi_y_; }
45
46
private
:
47
enum
class
DecodeStatus : uint8_t {
48
kHeader,
49
kPal,
50
kDataPre,
51
kData,
52
kTail,
53
};
54
55
enum
class
PalType :
bool
{ kNew, kOld };
56
57
BmpDecoder
::
Status
ReadBmpHeader();
58
BmpDecoder
::
Status
ReadBmpHeaderIfh();
59
BmpDecoder
::
Status
ReadBmpHeaderDimensions();
60
BmpDecoder
::
Status
ReadBmpBitfields();
61
BmpDecoder
::
Status
ReadBmpPalette();
62
bool
GetDataPosition(uint32_t cur_pos);
63
void
ReadNextScanline();
64
BmpDecoder
::
Status
DecodeRGB();
65
BmpDecoder
::
Status
DecodeRLE8();
66
BmpDecoder
::
Status
DecodeRLE4();
67
bool
ReadAllOrNone(pdfium::span<uint8_t> buf);
68
void
SaveDecodingStatus(DecodeStatus status);
69
bool
ValidateColorIndex(uint8_t val)
const
;
70
bool
ValidateFlag()
const
;
71
bool
SetHeight(int32_t signed_height);
72
int
PaletteChannelCount()
const
{
return
pal_type_ == PalType::kNew ? 4 : 3; }
73
74
UnownedPtr
<
const
CFX_BmpContext>
const
context_;
75
DataVector<uint8_t> out_row_buffer_;
76
std::vector<FX_ARGB> palette_;
77
uint32_t header_offset_ = 0;
78
uint32_t width_ = 0;
79
uint32_t height_ = 0;
80
uint32_t compress_flag_ = 0;
81
int32_t components_ = 0;
82
size_t src_row_bytes_ = 0;
83
size_t out_row_bytes_ = 0;
84
bool
img_tb_flag_ =
false
;
85
uint16_t bit_counts_ = 0;
86
uint32_t color_used_ = 0;
87
PalType pal_type_ = PalType::kNew;
88
uint32_t data_offset_ = 0;
89
uint32_t data_size_ = 0;
90
uint32_t img_ifh_size_ = 0;
91
uint32_t row_num_ = 0;
92
uint32_t col_num_ = 0;
93
int32_t dpi_x_ = 0;
94
int32_t dpi_y_ = 0;
95
uint32_t mask_red_ = 0;
96
uint32_t mask_green_ = 0;
97
uint32_t mask_blue_ = 0;
98
DecodeStatus decode_status_ = DecodeStatus::kHeader;
99
RetainPtr
<CFX_CodecMemory> input_buffer_;
100
};
101
102
}
// namespace fxcodec
103
104
#
endif
// CORE_FXCODEC_BMP_CFX_BMPDECOMPRESSOR_H_
BmpDecoder
fxcodec::BmpDecoder BmpDecoder
Definition
bmp_decoder.h:58
DCHECK
#define DCHECK
Definition
check.h:33
fxcodec::BmpDecoder::Delegate
Definition
bmp_decoder.h:28
fxcodec::BmpDecoder::Delegate::BmpReadScanline
virtual void BmpReadScanline(uint32_t row_num, pdfium::span< const uint8_t > row_buf)=0
fxcodec::BmpDecoder::Delegate::BmpInputImagePositionBuf
virtual bool BmpInputImagePositionBuf(uint32_t rcd_pos)=0
fxcodec::BmpDecoder
Definition
bmp_decoder.h:26
fxcodec::BmpDecoder::Status
Status
Definition
bmp_decoder.h:35
fxcodec::BmpDecoder::Status::kContinue
@ kContinue
Definition
bmp_decoder.h:35
fxcodec::BmpDecoder::Status::kFail
@ kFail
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::BmpDecoder
BmpDecoder(const BmpDecoder &)=delete
fxcodec::BmpDecoder::LoadImage
static Status LoadImage(ProgressiveDecoderIface::Context *pContext)
Definition
bmp_decoder.cpp:53
fxcodec::BmpDecoder::ReadHeader
static Status ReadHeader(ProgressiveDecoderIface::Context *pContext, int32_t *width, int32_t *height, bool *tb_flag, int32_t *components, pdfium::span< const FX_ARGB > *palette, CFX_DIBAttribute *pAttribute)
Definition
bmp_decoder.cpp:26
fxcodec::BmpDecoder::StartDecode
static std::unique_ptr< ProgressiveDecoderIface::Context > StartDecode(Delegate *pDelegate)
Definition
bmp_decoder.cpp:20
fxcodec::BmpDecoder::GetAvailInput
static FX_FILESIZE GetAvailInput(ProgressiveDecoderIface::Context *pContext)
Definition
bmp_decoder.cpp:59
fxcodec::BmpDecoder::BmpDecoder
BmpDecoder()=delete
fxcodec::BmpDecoder::operator=
BmpDecoder & operator=(const BmpDecoder &)=delete
fxcodec::CFX_BmpContext::m_pDelegate
UnownedPtr< BmpDecoder::Delegate > const m_pDelegate
Definition
cfx_bmpcontext.h:23
fxcodec::CFX_BmpContext::~CFX_BmpContext
~CFX_BmpContext() override
fxcodec::CFX_BmpContext::CFX_BmpContext
CFX_BmpContext(BmpDecoder::Delegate *pDelegate)
Definition
cfx_bmpcontext.cpp:11
fxcodec::CFX_BmpContext::m_Bmp
CFX_BmpDecompressor m_Bmp
Definition
cfx_bmpcontext.h:22
fxcodec::CFX_BmpDecompressor
Definition
cfx_bmpdecompressor.h:28
fxcodec::CFX_BmpDecompressor::dpi_y
int32_t dpi_y() const
Definition
cfx_bmpdecompressor.h:44
fxcodec::CFX_BmpDecompressor::GetAvailInput
FX_FILESIZE GetAvailInput() const
Definition
cfx_bmpdecompressor.cpp:680
fxcodec::CFX_BmpDecompressor::palette
pdfium::span< const FX_ARGB > palette() const
Definition
cfx_bmpdecompressor.h:38
fxcodec::CFX_BmpDecompressor::DecodeImage
BmpDecoder::Status DecodeImage()
Definition
cfx_bmpdecompressor.cpp:329
fxcodec::CFX_BmpDecompressor::~CFX_BmpDecompressor
~CFX_BmpDecompressor()
fxcodec::CFX_BmpDecompressor::img_tb_flag
bool img_tb_flag() const
Definition
cfx_bmpdecompressor.h:42
fxcodec::CFX_BmpDecompressor::height
uint32_t height() const
Definition
cfx_bmpdecompressor.h:40
fxcodec::CFX_BmpDecompressor::dpi_x
int32_t dpi_x() const
Definition
cfx_bmpdecompressor.h:43
fxcodec::CFX_BmpDecompressor::CFX_BmpDecompressor
CFX_BmpDecompressor(const CFX_BmpContext *context)
Definition
cfx_bmpdecompressor.cpp:58
fxcodec::CFX_BmpDecompressor::ReadHeader
BmpDecoder::Status ReadHeader()
Definition
cfx_bmpdecompressor.cpp:73
fxcodec::CFX_BmpDecompressor::components
int32_t components() const
Definition
cfx_bmpdecompressor.h:41
fxcodec::CFX_BmpDecompressor::SetInputBuffer
void SetInputBuffer(RetainPtr< CFX_CodecMemory > codec_memory)
Definition
cfx_bmpdecompressor.cpp:675
fxcodec::CFX_BmpDecompressor::width
uint32_t width() const
Definition
cfx_bmpdecompressor.h:39
fxcodec::ProgressiveDecoderIface::Context
Definition
progressive_decoder_iface.h:23
fxcodec::ProgressiveDecoderIface::Context::~Context
virtual ~Context()=default
fxcodec::ProgressiveDecoderIface
Definition
progressive_decoder_iface.h:21
fxcodec::ProgressiveDecoderIface::GetAvailInput
virtual FX_FILESIZE GetAvailInput(Context *pContext) const =0
fxcodec::ProgressiveDecoderIface::Input
virtual bool Input(Context *pContext, RetainPtr< CFX_CodecMemory > codec_memory)=0
fxcodec::ProgressiveDecoderIface::~ProgressiveDecoderIface
virtual ~ProgressiveDecoderIface()=default
fxcrt::RetainPtr
Definition
retain_ptr.h:28
fxcrt::UnownedPtr
Definition
unowned_ptr.h:76
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
cfx_bmpdecompressor.h
Generated on
for Qt by
1.18.0