summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/ccodec_progressivedecoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/codec/ccodec_progressivedecoder.cpp')
-rw-r--r--core/fxcodec/codec/ccodec_progressivedecoder.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.cpp b/core/fxcodec/codec/ccodec_progressivedecoder.cpp
index f7c9f6544d..c2d121d35a 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.cpp
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.cpp
@@ -716,9 +716,9 @@ bool CCodec_ProgressiveDecoder::BmpDetectImageTypeInBuffer(
return false;
}
- std::unique_ptr<CCodec_BmpModule::Context> pBmpContext =
+ std::unique_ptr<CodecModuleIface::Context> pBmpContext =
pBmpModule->Start(this);
- pBmpModule->Input(pBmpContext.get(), {m_pSrcBuf.get(), m_SrcSize});
+ pBmpModule->Input(pBmpContext.get(), {m_pSrcBuf.get(), m_SrcSize}, nullptr);
std::vector<uint32_t> palette;
int32_t readResult = pBmpModule->ReadHeader(
@@ -788,7 +788,7 @@ bool CCodec_ProgressiveDecoder::BmpDetectImageTypeInBuffer(
bool CCodec_ProgressiveDecoder::BmpReadMoreData(
CCodec_BmpModule* pBmpModule,
- CCodec_BmpModule::Context* pBmpContext,
+ CodecModuleIface::Context* pBmpContext,
FXCODEC_STATUS& err_status) {
uint32_t dwSize = (uint32_t)m_pFile->GetSize();
if (dwSize <= m_offSet)
@@ -825,7 +825,7 @@ bool CCodec_ProgressiveDecoder::BmpReadMoreData(
return false;
}
m_offSet += dwSize;
- pBmpModule->Input(pBmpContext, {m_pSrcBuf.get(), dwSize + dwAvail});
+ pBmpModule->Input(pBmpContext, {m_pSrcBuf.get(), dwSize + dwAvail}, nullptr);
return true;
}
@@ -919,9 +919,9 @@ bool CCodec_ProgressiveDecoder::GifReadMoreData(CCodec_GifModule* pGifModule,
}
m_offSet += dwAmountToFetchFromFile;
- pGifModule->Input(
- m_pGifContext.get(),
- {m_pSrcBuf.get(), dwAmountToFetchFromFile + dwUnusedBuffer});
+ pGifModule->Input(m_pGifContext.get(),
+ {m_pSrcBuf.get(), dwAmountToFetchFromFile + dwUnusedBuffer},
+ nullptr);
m_InvalidateGifBuffer = false;
return true;
}
@@ -934,7 +934,7 @@ bool CCodec_ProgressiveDecoder::GifDetectImageTypeInBuffer(
return false;
}
m_pGifContext = pGifModule->Start(this);
- pGifModule->Input(m_pGifContext.get(), {m_pSrcBuf.get(), m_SrcSize});
+ pGifModule->Input(m_pGifContext.get(), {m_pSrcBuf.get(), m_SrcSize}, nullptr);
m_SrcComponents = 1;
CFX_GifDecodeStatus readResult = pGifModule->ReadHeader(
m_pGifContext.get(), &m_SrcWidth, &m_SrcHeight, &m_GifPltNumber,
@@ -1138,7 +1138,8 @@ bool CCodec_ProgressiveDecoder::JpegReadMoreData(CCodec_JpegModule* pJpegModule,
return false;
}
m_offSet += dwSize;
- pJpegModule->Input(m_pJpegContext.get(), m_pSrcBuf.get(), dwSize + dwAvail);
+ pJpegModule->Input(m_pJpegContext.get(), {m_pSrcBuf.get(), dwSize + dwAvail},
+ nullptr);
return true;
}
@@ -1150,10 +1151,11 @@ bool CCodec_ProgressiveDecoder::JpegDetectImageTypeInBuffer(
m_status = FXCODEC_STATUS_ERR_MEMORY;
return false;
}
- pJpegModule->Input(m_pJpegContext.get(), m_pSrcBuf.get(), m_SrcSize);
+ pJpegModule->Input(m_pJpegContext.get(), {m_pSrcBuf.get(), m_SrcSize},
+ nullptr);
// Setting jump marker before calling ReadHeader, since a longjmp to
// the marker indicates a fatal error.
- if (setjmp(*m_pJpegContext->GetJumpMark()) == -1) {
+ if (setjmp(*pJpegModule->GetJumpMark(m_pJpegContext.get())) == -1) {
m_pJpegContext.reset();
m_status = FXCODEC_STATUS_ERR_FORMAT;
return false;
@@ -1184,17 +1186,17 @@ bool CCodec_ProgressiveDecoder::JpegDetectImageTypeInBuffer(
FXCODEC_STATUS CCodec_ProgressiveDecoder::JpegStartDecode(
const RetainPtr<CFX_DIBitmap>& pDIBitmap) {
+ CCodec_JpegModule* pJpegModule = m_pCodecMgr->GetJpegModule();
int down_scale = 1;
GetDownScale(down_scale);
// Setting jump marker before calling StartScanLine, since a longjmp to
// the marker indicates a fatal error.
- if (setjmp(*m_pJpegContext->GetJumpMark()) == -1) {
+ if (setjmp(*pJpegModule->GetJumpMark(m_pJpegContext.get())) == -1) {
m_pJpegContext.reset();
m_status = FXCODEC_STATUS_ERROR;
return FXCODEC_STATUS_ERROR;
}
- CCodec_JpegModule* pJpegModule = m_pCodecMgr->GetJpegModule();
bool startStatus =
pJpegModule->StartScanline(m_pJpegContext.get(), down_scale);
while (!startStatus) {
@@ -1235,7 +1237,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::JpegContinueDecode() {
CCodec_JpegModule* pJpegModule = m_pCodecMgr->GetJpegModule();
// Setting jump marker before calling ReadScanLine, since a longjmp to
// the marker indicates a fatal error.
- if (setjmp(*m_pJpegContext->GetJumpMark()) == -1) {
+ if (setjmp(*pJpegModule->GetJumpMark(m_pJpegContext.get())) == -1) {
m_pJpegContext.reset();
m_status = FXCODEC_STATUS_ERROR;
return FXCODEC_STATUS_ERROR;
@@ -1360,8 +1362,8 @@ bool CCodec_ProgressiveDecoder::PngDetectImageTypeInBuffer(
m_status = FXCODEC_STATUS_ERR_MEMORY;
return false;
}
- bool bResult = pPngModule->Input(m_pPngContext.get(), m_pSrcBuf.get(),
- m_SrcSize, pAttribute);
+ bool bResult = pPngModule->Input(m_pPngContext.get(),
+ {m_pSrcBuf.get(), m_SrcSize}, pAttribute);
while (bResult) {
uint32_t remain_size = static_cast<uint32_t>(m_pFile->GetSize()) - m_offSet;
uint32_t input_size =
@@ -1382,8 +1384,8 @@ bool CCodec_ProgressiveDecoder::PngDetectImageTypeInBuffer(
return false;
}
m_offSet += input_size;
- bResult = pPngModule->Input(m_pPngContext.get(), m_pSrcBuf.get(),
- input_size, pAttribute);
+ bResult = pPngModule->Input(m_pPngContext.get(),
+ {m_pSrcBuf.get(), input_size}, pAttribute);
}
m_pPngContext.reset();
if (m_SrcPassNumber == 0) {
@@ -1472,8 +1474,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::PngContinueDecode() {
return m_status;
}
m_offSet += input_size;
- bResult = pPngModule->Input(m_pPngContext.get(), m_pSrcBuf.get(),
- input_size, nullptr);
+ bResult = pPngModule->Input(m_pPngContext.get(),
+ {m_pSrcBuf.get(), input_size}, nullptr);
if (!bResult) {
m_pDeviceBitmap = nullptr;
m_pFile = nullptr;