summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_Context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_Context.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_Context.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp
index 76dff1d592..1763144b49 100644
--- a/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -1094,15 +1094,19 @@ int32_t CJBig2_Context::ParseGenericRegion(CJBig2_Segment* pSegment,
if (m_pGRD->MMR == 0) {
if (m_gbContext.empty())
m_gbContext.resize(GetHuffContextSize(m_pGRD->GBTEMPLATE));
- if (!m_pArithDecoder) {
+
+ bool bStart = !m_pArithDecoder;
+ if (bStart) {
m_pArithDecoder =
pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
- m_ProcessingStatus = m_pGRD->StartDecodeArith(
- &pSegment->m_Image, m_pArithDecoder.get(), &m_gbContext[0], pPause);
- } else {
- m_ProcessingStatus =
- m_pGRD->ContinueDecode(pPause, m_pArithDecoder.get());
}
+ CJBig2_GRDProc::ProgressiveArithDecodeState state;
+ state.pImage = &pSegment->m_Image;
+ state.pArithDecoder = m_pArithDecoder.get();
+ state.gbContext = m_gbContext.data();
+ state.pPause = pPause;
+ m_ProcessingStatus = bStart ? m_pGRD->StartDecodeArith(&state)
+ : m_pGRD->ContinueDecode(&state);
if (m_ProcessingStatus == FXCODEC_STATUS_DECODE_TOBECONTINUE) {
if (pSegment->m_cFlags.s.type != 36) {
if (!m_bBufSpecified) {