summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r--core/fxcodec/codec/ccodec_gifmodule.cpp31
-rw-r--r--core/fxcodec/codec/ccodec_gifmodule.h2
-rw-r--r--core/fxcodec/codec/ccodec_pngmodule.cpp22
-rw-r--r--core/fxcodec/codec/ccodec_progressivedecoder.h1
-rw-r--r--core/fxcodec/codec/fx_codec.cpp5
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp5
6 files changed, 14 insertions, 52 deletions
diff --git a/core/fxcodec/codec/ccodec_gifmodule.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp
index 33d74a9da4..70f55ceaa8 100644
--- a/core/fxcodec/codec/ccodec_gifmodule.cpp
+++ b/core/fxcodec/codec/ccodec_gifmodule.cpp
@@ -82,27 +82,18 @@ GifDecodeStatus CCodec_GifModule::LoadFrame(FXGIF_Context* ctx,
if (ret == GifDecodeStatus::Success) {
if (pAttribute) {
pAttribute->m_nGifLeft =
- (*ctx->m_Gif->img_ptr_arr_ptr)[frame_num]->image_info_ptr->left;
- pAttribute->m_nGifTop =
- (*ctx->m_Gif->img_ptr_arr_ptr)[frame_num]->image_info_ptr->top;
+ ctx->m_Gif->m_Images[frame_num]->m_ImageInfo.left;
+ pAttribute->m_nGifTop = ctx->m_Gif->m_Images[frame_num]->m_ImageInfo.top;
pAttribute->m_fAspectRatio = ctx->m_Gif->pixel_aspect;
- if (ctx->m_Gif->cmt_data_ptr) {
- const uint8_t* buf =
- (const uint8_t*)ctx->m_Gif->cmt_data_ptr->GetBuffer(0);
- uint32_t len = ctx->m_Gif->cmt_data_ptr->GetLength();
- if (len > 21) {
- uint8_t size = *buf++;
- if (size) {
- pAttribute->m_strAuthor = CFX_ByteString(buf, size);
- } else {
- pAttribute->m_strAuthor.clear();
- }
- buf += size;
- size = *buf++;
- if (size == 20) {
- memcpy(pAttribute->m_strTime, buf, size);
- }
- }
+ const uint8_t* buf =
+ reinterpret_cast<const uint8_t*>(ctx->m_Gif->cmt_data.GetBuffer(0));
+ uint32_t len = ctx->m_Gif->cmt_data.GetLength();
+ if (len > 21) {
+ uint8_t size = *buf++;
+ if (size != 0)
+ pAttribute->m_strAuthor = CFX_ByteString(buf, size);
+ else
+ pAttribute->m_strAuthor.clear();
}
}
}
diff --git a/core/fxcodec/codec/ccodec_gifmodule.h b/core/fxcodec/codec/ccodec_gifmodule.h
index c4298224b3..862bee5fe7 100644
--- a/core/fxcodec/codec/ccodec_gifmodule.h
+++ b/core/fxcodec/codec/ccodec_gifmodule.h
@@ -19,8 +19,6 @@ class CCodec_GifModule {
class Delegate {
public:
virtual void GifRecordCurrentPosition(uint32_t& cur_pos) = 0;
- virtual uint8_t* GifAskLocalPaletteBuf(int32_t frame_num,
- int32_t pal_size) = 0;
virtual bool GifInputRecordPositionBuf(uint32_t rcd_pos,
const FX_RECT& img_rc,
int32_t pal_num,
diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp
index 09bc1ac7e7..5529eae562 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.cpp
+++ b/core/fxcodec/codec/ccodec_pngmodule.cpp
@@ -50,19 +50,6 @@ static void _png_load_bmp_attribute(png_structp png_ptr,
png_get_iCCP(png_ptr, info_ptr, &icc_name, &compress_type, &icc_profile,
&icc_proflen);
#endif
- int bTime = 0;
-#if defined(PNG_tIME_SUPPORTED)
- png_timep t = nullptr;
- png_get_tIME(png_ptr, info_ptr, &t);
- if (t) {
- memset(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime));
- FXSYS_snprintf((char*)pAttribute->m_strTime,
- sizeof(pAttribute->m_strTime), "%4u:%2u:%2u %2u:%2u:%2u",
- t->year, t->month, t->day, t->hour, t->minute, t->second);
- pAttribute->m_strTime[sizeof(pAttribute->m_strTime) - 1] = 0;
- bTime = 1;
- }
-#endif
#if defined(PNG_TEXT_SUPPORTED)
int i;
FX_STRSIZE len;
@@ -73,14 +60,7 @@ static void _png_load_bmp_attribute(png_structp png_ptr,
for (i = 0; i < num_text; i++) {
len = FXSYS_strlen(text[i].key);
buf = "Time";
- if (!memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) {
- if (!bTime) {
- memset(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime));
- memcpy(
- pAttribute->m_strTime, text[i].text,
- std::min(sizeof(pAttribute->m_strTime) - 1, text[i].text_length));
- }
- } else {
+ if (memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) {
buf = "Author";
if (!memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) {
pAttribute->m_strAuthor =
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h
index f63c1ded0c..6fa0dafab0 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -179,7 +179,6 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate,
// CCodec_GifModule::Delegate
void GifRecordCurrentPosition(uint32_t& cur_pos) override;
- uint8_t* GifAskLocalPaletteBuf(int32_t frame_num, int32_t pal_size) override;
bool GifInputRecordPositionBuf(uint32_t rcd_pos,
const FX_RECT& img_rc,
int32_t pal_num,
diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp
index 38f5a7608d..e695bc97c6 100644
--- a/core/fxcodec/codec/fx_codec.cpp
+++ b/core/fxcodec/codec/fx_codec.cpp
@@ -252,9 +252,8 @@ CFX_DIBAttribute::CFX_DIBAttribute()
m_nGifTop(0),
m_pGifLocalPalette(nullptr),
m_nGifLocalPalNum(0),
- m_nBmpCompressType(0) {
- memset(m_strTime, 0, sizeof(m_strTime));
-}
+ m_nBmpCompressType(0) {}
+
CFX_DIBAttribute::~CFX_DIBAttribute() {
for (const auto& pair : m_Exif)
FX_Free(pair.second);
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index 56c9ed9534..c61cb0bbaf 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -615,11 +615,6 @@ void CCodec_ProgressiveDecoder::GifRecordCurrentPosition(uint32_t& cur_pos) {
cur_pos = m_offSet - remain_size;
}
-uint8_t* CCodec_ProgressiveDecoder::GifAskLocalPaletteBuf(int32_t frame_num,
- int32_t pal_size) {
- return FX_Alloc(uint8_t, pal_size);
-}
-
bool CCodec_ProgressiveDecoder::GifInputRecordPositionBuf(
uint32_t rcd_pos,
const FX_RECT& img_rc,