aboutsummaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_Context.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_Context.h')
-rw-r--r--core/fxcodec/jbig2/JBig2_Context.h27
1 files changed, 11 insertions, 16 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h
index 49669edb8..279db5bac 100644
--- a/core/fxcodec/jbig2/JBig2_Context.h
+++ b/core/fxcodec/jbig2/JBig2_Context.h
@@ -1,4 +1,4 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2014 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,21 +13,16 @@
#include <vector>
#include "core/fxcodec/fx_codec_def.h"
+#include "core/fxcodec/jbig2/JBig2_DocumentContext.h"
#include "core/fxcodec/jbig2/JBig2_Page.h"
#include "core/fxcodec/jbig2/JBig2_Segment.h"
-#include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/unowned_ptr.h"
#include "third_party/base/span.h"
class CJBig2_ArithDecoder;
class CJBig2_GRDProc;
-class CPDF_StreamAcc;
class PauseIndicatorIface;
-// Cache is keyed by the ObjNum of a stream and an index within the stream.
-using CJBig2_CacheKey = std::pair<uint32_t, uint32_t>;
-using CJBig2_CachePair =
- std::pair<CJBig2_CacheKey, std::unique_ptr<CJBig2_SymbolDict>>;
-
#define JBIG2_MIN_SEGMENT_SIZE 11
enum class JBig2_Result { kSuccess, kFailure, kEndReached };
@@ -36,16 +31,16 @@ class CJBig2_Context {
public:
static std::unique_ptr<CJBig2_Context> Create(
pdfium::span<const uint8_t> pGlobalSpan,
- uint32_t dwGlobalObjNum,
+ uint64_t global_key,
pdfium::span<const uint8_t> pSrcSpan,
- uint32_t dwSrcObjNum,
+ uint64_t src_key,
std::list<CJBig2_CachePair>* pSymbolDictCache);
~CJBig2_Context();
static bool HuffmanAssignCode(JBig2HuffmanCode* SBSYMCODES, uint32_t NTEMP);
- bool GetFirstPage(uint8_t* pBuf,
+ bool GetFirstPage(pdfium::span<uint8_t> pBuf,
int32_t width,
int32_t height,
int32_t stride,
@@ -56,7 +51,7 @@ class CJBig2_Context {
private:
CJBig2_Context(pdfium::span<const uint8_t> pSrcSpan,
- uint32_t dwObjNum,
+ uint64_t src_key,
std::list<CJBig2_CachePair>* pSymbolDictCache,
bool bIsGlobal);
@@ -96,14 +91,14 @@ class CJBig2_Context {
bool m_bInPage = false;
bool m_bBufSpecified = false;
int32_t m_PauseStep = 10;
- FXCODEC_STATUS m_ProcessingStatus = FXCODEC_STATUS_FRAME_READY;
+ FXCODEC_STATUS m_ProcessingStatus = FXCODEC_STATUS::kFrameReady;
std::vector<JBig2ArithCtx> m_gbContext;
std::unique_ptr<CJBig2_ArithDecoder> m_pArithDecoder;
std::unique_ptr<CJBig2_GRDProc> m_pGRD;
std::unique_ptr<CJBig2_Segment> m_pSegment;
- FX_SAFE_UINT32 m_dwOffset = 0;
- JBig2RegionInfo m_ri;
- std::list<CJBig2_CachePair>* const m_pSymbolDictCache;
+ uint32_t m_nOffset = 0;
+ JBig2RegionInfo m_ri = {};
+ UnownedPtr<std::list<CJBig2_CachePair>> const m_pSymbolDictCache;
};
#endif // CORE_FXCODEC_JBIG2_JBIG2_CONTEXT_H_