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
13namespace fxcodec {
14
15// static
16std::unique_ptr<ProgressiveDecoderIface::Context> GifDecoder::StartDecode(
17 Delegate* pDelegate) {
18 return std::make_unique<CFX_GifContext>(pDelegate);
19}
20
21// static
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
41std::pair<GifDecoder::Status, size_t> GifDecoder::LoadFrameInfo(
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
53 size_t frame_num) {
54 return static_cast<CFX_GifContext*>(pContext)->LoadFrame(frame_num);
55}
56
57// static
62
63// static
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
GifDecoder::Status GetFrame()
void SetInputBuffer(RetainPtr< CFX_CodecMemory > codec_memory)
uint32_t GetAvailInput() const
GifDecoder::Status ReadHeader()
static FX_FILESIZE GetAvailInput(ProgressiveDecoderIface::Context *context)
static bool Input(ProgressiveDecoderIface::Context *context, RetainPtr< CFX_CodecMemory > codec_memory)
#define FX_FILESIZE
Definition fx_types.h:19