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_codec_memory.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
#
ifndef
CORE_FXCODEC_CFX_CODEC_MEMORY_H_
6
#
define
CORE_FXCODEC_CFX_CODEC_MEMORY_H_
7
8
#
include
<
memory
>
9
10
#
include
"core/fxcrt/compiler_specific.h"
11
#
include
"core/fxcrt/fx_memory_wrappers.h"
12
#
include
"core/fxcrt/retain_ptr.h"
13
#
include
"core/fxcrt/span.h"
14
15
class
CFX_CodecMemory
final
:
public
Retainable
{
16
public
:
17
CONSTRUCT_VIA_MAKE_RETAIN
;
18
19
// Returns a span over the unconsumed contents of the buffer.
20
pdfium
::
span
<
uint8_t
>
GetUnconsumedSpan
() {
21
return
GetBufferSpan().subspan(pos_);
22
}
23
24
// SAFETY: `size_` must track `buffer_` allocations.
25
pdfium
::
span
<
uint8_t
>
GetBufferSpan
() {
26
return
UNSAFE_BUFFERS
(
pdfium
::make_span(buffer_.get(), size_));
27
}
28
size_t
GetSize
()
const
{
return
size_; }
29
size_t
GetPosition
()
const
{
return
pos_; }
30
bool
IsEOF
()
const
{
return
pos_ >= size_; }
31
size_t
ReadBlock
(pdfium::span<uint8_t> buffer);
32
33
// Sets the cursor position to |pos| if possible.
34
bool
Seek
(size_t pos);
35
36
// Try to change the size of the buffer, keep the old one on failure.
37
bool
TryResize
(size_t new_buffer_size);
38
39
// Schlep the bytes down the buffer.
40
void
Consume
(size_t consumed);
41
42
private
:
43
explicit
CFX_CodecMemory(size_t buffer_size);
44
~
CFX_CodecMemory
()
override
;
45
46
// TODO(tsepez): convert to a fixed array type.
47
std
::unique_ptr<uint8_t,
FxFreeDeleter
> buffer_;
48
size_t size_ = 0;
49
size_t pos_ = 0;
50
};
51
52
#
endif
// CORE_FXCODEC_CFX_CODEC_MEMORY_H_
BmpDecoder
fxcodec::BmpDecoder BmpDecoder
Definition
bmp_decoder.h:58
DCHECK
#define DCHECK
Definition
check.h:33
CFX_CodecMemory::TryResize
bool TryResize(size_t new_buffer_size)
Definition
cfx_codec_memory.cpp:35
CFX_CodecMemory::IsEOF
bool IsEOF() const
Definition
cfx_codec_memory.h:30
CFX_CodecMemory::GetBufferSpan
pdfium::span< uint8_t > GetBufferSpan()
Definition
cfx_codec_memory.h:25
CFX_CodecMemory::GetSize
size_t GetSize() const
Definition
cfx_codec_memory.h:28
CFX_CodecMemory::~CFX_CodecMemory
~CFX_CodecMemory() override
CFX_CodecMemory::ReadBlock
size_t ReadBlock(pdfium::span< uint8_t > buffer)
Definition
cfx_codec_memory.cpp:25
CFX_CodecMemory::GetUnconsumedSpan
pdfium::span< uint8_t > GetUnconsumedSpan()
Definition
cfx_codec_memory.h:20
CFX_CodecMemory::Seek
bool Seek(size_t pos)
Definition
cfx_codec_memory.cpp:17
CFX_CodecMemory::GetPosition
size_t GetPosition() const
Definition
cfx_codec_memory.h:29
CFX_CodecMemory::Consume
void Consume(size_t consumed)
Definition
cfx_codec_memory.cpp:47
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::Retainable
Definition
retain_ptr.h:156
fxcrt::UnownedPtr
Definition
unowned_ptr.h:76
pdfium::CFDETextOutLargeBitmapTest
Definition
cfde_textout_unittest.cpp:117
UNSAFE_BUFFERS
#define UNSAFE_BUFFERS(...)
Definition
compiler_specific.h:95
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
CONSTRUCT_VIA_MAKE_RETAIN
#define CONSTRUCT_VIA_MAKE_RETAIN
Definition
retain_ptr.h:222
BmpCoreHeader
Definition
fx_bmp.h:21
BmpCoreHeader::bcBitCount
uint16_t bcBitCount
Definition
fx_bmp.h:26
BmpCoreHeader::bcWidth
uint16_t bcWidth
Definition
fx_bmp.h:23
BmpCoreHeader::bcHeight
uint16_t bcHeight
Definition
fx_bmp.h:24
BmpCoreHeader::bcPlanes
uint16_t bcPlanes
Definition
fx_bmp.h:25
BmpCoreHeader::bcSize
uint32_t bcSize
Definition
fx_bmp.h:22
BmpFileHeader
Definition
fx_bmp.h:13
BmpFileHeader::bfSize
uint32_t bfSize
Definition
fx_bmp.h:15
BmpFileHeader::bfOffBits
uint32_t bfOffBits
Definition
fx_bmp.h:18
BmpFileHeader::bfReserved2
uint16_t bfReserved2
Definition
fx_bmp.h:17
BmpFileHeader::bfType
uint16_t bfType
Definition
fx_bmp.h:14
BmpFileHeader::bfReserved1
uint16_t bfReserved1
Definition
fx_bmp.h:16
BmpInfoHeader
Definition
fx_bmp.h:29
BmpInfoHeader::biClrUsed
uint32_t biClrUsed
Definition
fx_bmp.h:39
BmpInfoHeader::biWidth
int32_t biWidth
Definition
fx_bmp.h:31
BmpInfoHeader::biSizeImage
uint32_t biSizeImage
Definition
fx_bmp.h:36
BmpInfoHeader::biPlanes
uint16_t biPlanes
Definition
fx_bmp.h:33
BmpInfoHeader::biHeight
int32_t biHeight
Definition
fx_bmp.h:32
BmpInfoHeader::biBitCount
uint16_t biBitCount
Definition
fx_bmp.h:34
BmpInfoHeader::biCompression
uint32_t biCompression
Definition
fx_bmp.h:35
BmpInfoHeader::biYPelsPerMeter
int32_t biYPelsPerMeter
Definition
fx_bmp.h:38
BmpInfoHeader::biSize
uint32_t biSize
Definition
fx_bmp.h:30
BmpInfoHeader::biClrImportant
uint32_t biClrImportant
Definition
fx_bmp.h:40
BmpInfoHeader::biXPelsPerMeter
int32_t biXPelsPerMeter
Definition
fx_bmp.h:37
FxFreeDeleter
Definition
fx_memory_wrappers.h:15
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcodec
cfx_codec_memory.h
Generated on
for Qt by
1.18.0