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
gif_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/gif/gif_decoder.h"
8
9
#
include
"core/fxcodec/cfx_codec_memory.h"
10
#
include
"core/fxcodec/gif/cfx_gifcontext.h"
11
#
include
"core/fxge/dib/fx_dib.h"
12
13
namespace
fxcodec
{
14
15
// static
16
std::unique_ptr<ProgressiveDecoderIface::Context>
GifDecoder
::StartDecode(
17
Delegate
* pDelegate) {
18
return
std
::make_unique<
CFX_GifContext
>(pDelegate);
19
}
20
21
// static
22
GifDecoder
::
Status
GifDecoder
::ReadHeader(
23
ProgressiveDecoderIface
::
Context
* pContext,
24
int
* width,
25
int
* height,
26
pdfium::span<CFX_GifPalette>* palette,
27
int
* bg_index) {
28
auto
* context =
static_cast
<
CFX_GifContext
*>(pContext);
29
Status
ret = context
->
ReadHeader
(
)
;
30
if
(ret !=
Status
::
kSuccess
)
31
return
ret;
32
33
*width = context
->
width_
;
34
*height = context
->
height_
;
35
*palette = context->global_palette_;
36
*bg_index = context
->
bc_index_
;
37
return
Status
::
kSuccess
;
38
}
39
40
// static
41
std::pair<GifDecoder::Status, size_t>
GifDecoder
::LoadFrameInfo(
42
ProgressiveDecoderIface
::
Context
* pContext) {
43
auto
* context =
static_cast
<
CFX_GifContext
*>(pContext);
44
Status
ret = context
->
GetFrame
(
)
;
45
if
(ret !=
Status
::
kSuccess
)
46
return
{ret, 0};
47
return
{
Status
::
kSuccess
, context->GetFrameNum()};
48
}
49
50
// static
51
GifDecoder
::
Status
GifDecoder
::LoadFrame(
52
ProgressiveDecoderIface
::
Context
* pContext,
53
size_t frame_num) {
54
return
static_cast
<
CFX_GifContext
*>(pContext)->LoadFrame(frame_num);
55
}
56
57
// static
58
FX_FILESIZE
GifDecoder
::
GetAvailInput
(
59
ProgressiveDecoderIface
::
Context
* pContext) {
60
return
static_cast
<
CFX_GifContext
*>(pContext)
->
GetAvailInput
(
)
;
61
}
62
63
// static
64
bool
GifDecoder
::
Input
(
ProgressiveDecoderIface
::
Context
* pContext,
65
RetainPtr
<CFX_CodecMemory> codec_memory) {
66
auto
* ctx =
static_cast
<
CFX_GifContext
*>(pContext);
67
ctx
->
SetInputBuffer
(
std
::move(codec_memory)
)
;
68
return
true
;
69
}
70
71
}
// namespace fxcodec
fxcodec::CFX_GifContext
Definition
cfx_gifcontext.h:25
fxcodec::CFX_GifContext::GetFrame
GifDecoder::Status GetFrame()
Definition
cfx_gifcontext.cpp:61
fxcodec::CFX_GifContext::SetInputBuffer
void SetInputBuffer(RetainPtr< CFX_CodecMemory > codec_memory)
Definition
cfx_gifcontext.cpp:316
fxcodec::CFX_GifContext::height_
int height_
Definition
cfx_gifcontext.h:56
fxcodec::CFX_GifContext::bc_index_
uint8_t bc_index_
Definition
cfx_gifcontext.h:57
fxcodec::CFX_GifContext::width_
int width_
Definition
cfx_gifcontext.h:55
fxcodec::CFX_GifContext::GetAvailInput
uint32_t GetAvailInput() const
Definition
cfx_gifcontext.cpp:320
fxcodec::CFX_GifContext::ReadHeader
GifDecoder::Status ReadHeader()
Definition
cfx_gifcontext.cpp:54
fxcodec::GifDecoder::Delegate
Definition
gif_decoder.h:32
fxcodec::GifDecoder
Definition
gif_decoder.h:24
fxcodec::GifDecoder::GetAvailInput
static FX_FILESIZE GetAvailInput(ProgressiveDecoderIface::Context *context)
Definition
gif_decoder.cpp:58
fxcodec::GifDecoder::Input
static bool Input(ProgressiveDecoderIface::Context *context, RetainPtr< CFX_CodecMemory > codec_memory)
Definition
gif_decoder.cpp:64
fxcodec::GifDecoder::Status
Status
Definition
gif_decoder.h:26
fxcodec::GifDecoder::Status::kSuccess
@ kSuccess
Definition
gif_decoder.h:28
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
gif
gif_decoder.cpp
Generated on
for Qt by
1.14.0