1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// Copyright 2017 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "core/fxcodec/lgif/cgifcontext.h"
#include <utility>
#include "core/fxcodec/codec/ccodec_gifmodule.h"
#include "core/fxcodec/lgif/fx_gif.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
CGifContext::CGifContext(CCodec_GifModule* gif_module,
CCodec_GifModule::Delegate* pDelegate)
: m_pModule(gif_module),
m_pDelegate(pDelegate),
global_pal_num(0),
img_row_offset(0),
img_row_avail_size(0),
avail_in(0),
decode_status(GIF_D_STATUS_SIG),
skip_size(0),
next_in(nullptr),
width(0),
height(0),
bc_index(0),
pixel_aspect(0),
global_sort_flag(0),
global_color_resolution(0),
img_pass_num(0) {
memset(m_szLastError, 0, sizeof(m_szLastError));
}
CGifContext::~CGifContext() {}
void CGifContext::AddError(const char* err_msg) {
strncpy(m_szLastError, err_msg, GIF_MAX_ERROR_SIZE - 1);
}
void CGifContext::RecordCurrentPosition(uint32_t* cur_pos_ptr) {
m_pDelegate->GifRecordCurrentPosition(*cur_pos_ptr);
}
void CGifContext::ReadScanline(int32_t row_num, uint8_t* row_buf) {
m_pDelegate->GifReadScanline(row_num, row_buf);
}
bool CGifContext::GetRecordPosition(uint32_t cur_pos,
int32_t left,
int32_t top,
int32_t width,
int32_t height,
int32_t pal_num,
GifPalette* pal_ptr,
int32_t delay_time,
bool user_input,
int32_t trans_index,
int32_t disposal_method,
bool interlace) {
return m_pDelegate->GifInputRecordPositionBuf(
cur_pos, FX_RECT(left, top, left + width, top + height), pal_num, pal_ptr,
delay_time, user_input, trans_index, disposal_method, interlace);
}
|