Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: core/src/fxcodec/jbig2/JBig2_BitStream.h

Issue 1380243004: Various changes to JBig2 cache: (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_SRC_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_ 7 #ifndef CORE_SRC_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_
8 #define CORE_SRC_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_ 8 #define CORE_SRC_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_
9 9
10 #include "../../../include/fpdfapi/fpdf_objects.h"
Lei Zhang 2015/10/08 03:22:44 ditto, forward declare instead.
David Lattimore 2015/10/08 03:44:39 Done.
10 #include "../../../include/fxcrt/fx_basic.h" 11 #include "../../../include/fxcrt/fx_basic.h"
11 12
12 class CJBig2_BitStream { 13 class CJBig2_BitStream {
13 public: 14 public:
14 CJBig2_BitStream(const uint8_t* pBuffer, FX_DWORD dwLength); 15 explicit CJBig2_BitStream(CPDF_StreamAcc* pSrcStream);
15 ~CJBig2_BitStream(); 16 ~CJBig2_BitStream();
16 17
17 // TODO(thestig): readFoo() should return bool. 18 // TODO(thestig): readFoo() should return bool.
18 int32_t readNBits(FX_DWORD nBits, FX_DWORD* dwResult); 19 int32_t readNBits(FX_DWORD nBits, FX_DWORD* dwResult);
19 int32_t readNBits(FX_DWORD nBits, int32_t* nResult); 20 int32_t readNBits(FX_DWORD nBits, int32_t* nResult);
20 int32_t read1Bit(FX_DWORD* dwResult); 21 int32_t read1Bit(FX_DWORD* dwResult);
21 int32_t read1Bit(FX_BOOL* bResult); 22 int32_t read1Bit(FX_BOOL* bResult);
22 int32_t read1Byte(uint8_t* cResult); 23 int32_t read1Byte(uint8_t* cResult);
23 int32_t readInteger(FX_DWORD* dwResult); 24 int32_t readInteger(FX_DWORD* dwResult);
24 int32_t readShortInteger(FX_WORD* wResult); 25 int32_t readShortInteger(FX_WORD* wResult);
25 void alignByte(); 26 void alignByte();
26 uint8_t getCurByte() const; 27 uint8_t getCurByte() const;
27 void incByteIdx(); 28 void incByteIdx();
28 uint8_t getCurByte_arith() const; 29 uint8_t getCurByte_arith() const;
29 uint8_t getNextByte_arith() const; 30 uint8_t getNextByte_arith() const;
30 FX_DWORD getOffset() const; 31 FX_DWORD getOffset() const;
31 void setOffset(FX_DWORD dwOffset); 32 void setOffset(FX_DWORD dwOffset);
32 FX_DWORD getBitPos() const; 33 FX_DWORD getBitPos() const;
33 void setBitPos(FX_DWORD dwBitPos); 34 void setBitPos(FX_DWORD dwBitPos);
34 const uint8_t* getBuf() const; 35 const uint8_t* getBuf() const;
35 FX_DWORD getLength() const { return m_dwLength; } 36 FX_DWORD getLength() const { return m_dwLength; }
36 const uint8_t* getPointer() const; 37 const uint8_t* getPointer() const;
37 void offset(FX_DWORD dwOffset); 38 void offset(FX_DWORD dwOffset);
38 FX_DWORD getByteLeft() const; 39 FX_DWORD getByteLeft() const;
39 40
41 FX_DWORD getObjNum() const;
Lei Zhang 2015/10/08 03:22:44 nit: this method looks lonely sitting by itself.
David Lattimore 2015/10/08 03:44:39 Done.
42
40 private: 43 private:
41 void AdvanceBit(); 44 void AdvanceBit();
42 bool IsInBound() const; 45 bool IsInBound() const;
43 FX_DWORD LengthInBits() const; 46 FX_DWORD LengthInBits() const;
44 47
45 const uint8_t* m_pBuf; 48 const uint8_t* m_pBuf;
46 FX_DWORD m_dwLength; 49 FX_DWORD m_dwLength;
47 FX_DWORD m_dwByteIdx; 50 FX_DWORD m_dwByteIdx;
48 FX_DWORD m_dwBitIdx; 51 FX_DWORD m_dwBitIdx;
52 const FX_DWORD m_dwObjNum;
49 53
50 CJBig2_BitStream(const CJBig2_BitStream&) = delete; 54 CJBig2_BitStream(const CJBig2_BitStream&) = delete;
51 void operator=(const CJBig2_BitStream&) = delete; 55 void operator=(const CJBig2_BitStream&) = delete;
52 }; 56 };
53 57
54 #endif // CORE_SRC_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_ 58 #endif // CORE_SRC_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698