diff options
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r-- | core/fxcodec/codec/ccodec_gifmodule.cpp | 80 | ||||
-rw-r--r-- | core/fxcodec/codec/ccodec_gifmodule.h | 24 | ||||
-rw-r--r-- | core/fxcodec/codec/fx_codec_progress.cpp | 18 |
3 files changed, 61 insertions, 61 deletions
diff --git a/core/fxcodec/codec/ccodec_gifmodule.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp index b7e55d5208..0567af06ea 100644 --- a/core/fxcodec/codec/ccodec_gifmodule.cpp +++ b/core/fxcodec/codec/ccodec_gifmodule.cpp @@ -8,8 +8,8 @@ #include "core/fxcodec/codec/codec_int.h" #include "core/fxcodec/fx_codec.h" -#include "core/fxcodec/lgif/cgifcontext.h" -#include "core/fxcodec/lgif/fx_gif.h" +#include "core/fxcodec/gif/cfx_gif.h" +#include "core/fxcodec/gif/cfx_gifcontext.h" #include "core/fxge/fx_dib.h" #include "third_party/base/ptr_util.h" @@ -19,55 +19,55 @@ CCodec_GifModule::~CCodec_GifModule() {} std::unique_ptr<CCodec_GifModule::Context> CCodec_GifModule::Start( Delegate* pDelegate) { - return pdfium::MakeUnique<CGifContext>(this, pDelegate); + return pdfium::MakeUnique<CFX_GifContext>(this, pDelegate); } -GifDecodeStatus CCodec_GifModule::ReadHeader(Context* pContext, - int* width, - int* height, - int* pal_num, - void** pal_pp, - int* bg_index, - CFX_DIBAttribute* pAttribute) { - auto* context = static_cast<CGifContext*>(pContext); - GifDecodeStatus ret = context->ReadHeader(); - if (ret != GifDecodeStatus::Success) +CFX_GifDecodeStatus CCodec_GifModule::ReadHeader(Context* pContext, + int* width, + int* height, + int* pal_num, + void** pal_pp, + int* bg_index, + CFX_DIBAttribute* pAttribute) { + auto* context = static_cast<CFX_GifContext*>(pContext); + CFX_GifDecodeStatus ret = context->ReadHeader(); + if (ret != CFX_GifDecodeStatus::Success) return ret; - *width = context->width; - *height = context->height; - *pal_num = (2 << context->global_pal_exp); - *pal_pp = context->m_GlobalPalette.empty() ? nullptr - : context->m_GlobalPalette.data(); - *bg_index = context->bc_index; - return GifDecodeStatus::Success; + *width = context->width_; + *height = context->height_; + *pal_num = (2 << context->global_pal_exp_); + *pal_pp = context->global_palette_.empty() ? nullptr + : context->global_palette_.data(); + *bg_index = context->bc_index_; + return CFX_GifDecodeStatus::Success; } -GifDecodeStatus CCodec_GifModule::LoadFrameInfo(Context* pContext, - int* frame_num) { - auto* context = static_cast<CGifContext*>(pContext); - GifDecodeStatus ret = context->GetFrame(); - if (ret != GifDecodeStatus::Success) +CFX_GifDecodeStatus CCodec_GifModule::LoadFrameInfo(Context* pContext, + int* frame_num) { + auto* context = static_cast<CFX_GifContext*>(pContext); + CFX_GifDecodeStatus ret = context->GetFrame(); + if (ret != CFX_GifDecodeStatus::Success) return ret; *frame_num = context->GetFrameNum(); - return GifDecodeStatus::Success; + return CFX_GifDecodeStatus::Success; } -GifDecodeStatus CCodec_GifModule::LoadFrame(Context* pContext, - int frame_num, - CFX_DIBAttribute* pAttribute) { - auto* context = static_cast<CGifContext*>(pContext); - GifDecodeStatus ret = context->LoadFrame(frame_num); - if (ret != GifDecodeStatus::Success || !pAttribute) +CFX_GifDecodeStatus CCodec_GifModule::LoadFrame(Context* pContext, + int frame_num, + CFX_DIBAttribute* pAttribute) { + auto* context = static_cast<CFX_GifContext*>(pContext); + CFX_GifDecodeStatus ret = context->LoadFrame(frame_num); + if (ret != CFX_GifDecodeStatus::Success || !pAttribute) return ret; - pAttribute->m_nGifLeft = context->m_Images[frame_num]->m_ImageInfo.left; - pAttribute->m_nGifTop = context->m_Images[frame_num]->m_ImageInfo.top; - pAttribute->m_fAspectRatio = context->pixel_aspect; + pAttribute->m_nGifLeft = context->images_[frame_num]->image_info.left; + pAttribute->m_nGifTop = context->images_[frame_num]->image_info.top; + pAttribute->m_fAspectRatio = context->pixel_aspect_; const uint8_t* buf = - reinterpret_cast<const uint8_t*>(context->cmt_data.GetBuffer(0)); - uint32_t len = context->cmt_data.GetLength(); + reinterpret_cast<const uint8_t*>(context->cmt_data_.GetBuffer(0)); + uint32_t len = context->cmt_data_.GetLength(); if (len > 21) { uint8_t size = *buf++; if (size != 0) @@ -75,18 +75,18 @@ GifDecodeStatus CCodec_GifModule::LoadFrame(Context* pContext, else pAttribute->m_strAuthor.clear(); } - return GifDecodeStatus::Success; + return CFX_GifDecodeStatus::Success; } uint32_t CCodec_GifModule::GetAvailInput(Context* pContext, uint8_t** avail_buf_ptr) { - auto* context = static_cast<CGifContext*>(pContext); + auto* context = static_cast<CFX_GifContext*>(pContext); return context->GetAvailInput(avail_buf_ptr); } void CCodec_GifModule::Input(Context* pContext, const uint8_t* src_buf, uint32_t src_size) { - auto* context = static_cast<CGifContext*>(pContext); + auto* context = static_cast<CFX_GifContext*>(pContext); context->SetInputBuffer((uint8_t*)src_buf, src_size); } diff --git a/core/fxcodec/codec/ccodec_gifmodule.h b/core/fxcodec/codec/ccodec_gifmodule.h index fe1c46478d..886c902bba 100644 --- a/core/fxcodec/codec/ccodec_gifmodule.h +++ b/core/fxcodec/codec/ccodec_gifmodule.h @@ -9,7 +9,7 @@ #include <memory> -#include "core/fxcodec/lgif/fx_gif.h" +#include "core/fxcodec/gif/cfx_gif.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" @@ -43,17 +43,17 @@ class CCodec_GifModule { std::unique_ptr<Context> Start(Delegate* pDelegate); uint32_t GetAvailInput(Context* context, uint8_t** avail_buf_ptr = nullptr); void Input(Context* context, const uint8_t* src_buf, uint32_t src_size); - GifDecodeStatus ReadHeader(Context* context, - int* width, - int* height, - int* pal_num, - void** pal_pp, - int* bg_index, - CFX_DIBAttribute* pAttribute); - GifDecodeStatus LoadFrameInfo(Context* context, int* frame_num); - GifDecodeStatus LoadFrame(Context* context, - int frame_num, - CFX_DIBAttribute* pAttribute); + CFX_GifDecodeStatus ReadHeader(Context* context, + int* width, + int* height, + int* pal_num, + void** pal_pp, + int* bg_index, + CFX_DIBAttribute* pAttribute); + CFX_GifDecodeStatus LoadFrameInfo(Context* context, int* frame_num); + CFX_GifDecodeStatus LoadFrame(Context* context, + int frame_num, + CFX_DIBAttribute* pAttribute); }; #endif // CORE_FXCODEC_CODEC_CCODEC_GIFMODULE_H_ diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index d28277173e..746a574bbc 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -1203,10 +1203,10 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, m_offSet += size; pGifModule->Input(m_pGifContext.get(), m_pSrcBuf, size); m_SrcComponents = 1; - GifDecodeStatus readResult = pGifModule->ReadHeader( + CFX_GifDecodeStatus readResult = pGifModule->ReadHeader( m_pGifContext.get(), &m_SrcWidth, &m_SrcHeight, &m_GifPltNumber, (void**)&m_pGifPalette, &m_GifBgIndex, nullptr); - while (readResult == GifDecodeStatus::Unfinished) { + while (readResult == CFX_GifDecodeStatus::Unfinished) { FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT; if (!GifReadMoreData(pGifModule, error_status)) { m_pGifContext = nullptr; @@ -1217,7 +1217,7 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, m_pGifContext.get(), &m_SrcWidth, &m_SrcHeight, &m_GifPltNumber, (void**)&m_pGifPalette, &m_GifBgIndex, nullptr); } - if (readResult == GifDecodeStatus::Success) { + if (readResult == CFX_GifDecodeStatus::Success) { m_SrcBPC = 8; m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight); return true; @@ -1815,9 +1815,9 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(int32_t* frames) { return m_status; } while (true) { - GifDecodeStatus readResult = + CFX_GifDecodeStatus readResult = pGifModule->LoadFrameInfo(m_pGifContext.get(), &m_FrameNumber); - while (readResult == GifDecodeStatus::Unfinished) { + while (readResult == CFX_GifDecodeStatus::Unfinished) { FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_READ; if (!GifReadMoreData(pGifModule, error_status)) return error_status; @@ -1825,7 +1825,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(int32_t* frames) { readResult = pGifModule->LoadFrameInfo(m_pGifContext.get(), &m_FrameNumber); } - if (readResult == GifDecodeStatus::Success) { + if (readResult == CFX_GifDecodeStatus::Success) { *frames = m_FrameNumber; m_status = FXCODEC_STATUS_DECODE_READY; return m_status; @@ -2118,9 +2118,9 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() { return m_status; } - GifDecodeStatus readRes = + CFX_GifDecodeStatus readRes = pGifModule->LoadFrame(m_pGifContext.get(), m_FrameCur, nullptr); - while (readRes == GifDecodeStatus::Unfinished) { + while (readRes == CFX_GifDecodeStatus::Unfinished) { FXCODEC_STATUS error_status = FXCODEC_STATUS_DECODE_FINISH; if (!GifReadMoreData(pGifModule, error_status)) { m_pDeviceBitmap = nullptr; @@ -2132,7 +2132,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() { pGifModule->LoadFrame(m_pGifContext.get(), m_FrameCur, nullptr); } - if (readRes == GifDecodeStatus::Success) { + if (readRes == CFX_GifDecodeStatus::Success) { m_pDeviceBitmap = nullptr; m_pFile = nullptr; m_status = FXCODEC_STATUS_DECODE_FINISH; |