OLD | NEW |
1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "core/fxcodec/jbig2/JBig2_BitStream.h" | 7 #include "core/fxcodec/jbig2/JBig2_BitStream.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 int32_t CJBig2_BitStream::read1Bit(uint32_t* dwResult) { | 67 int32_t CJBig2_BitStream::read1Bit(uint32_t* dwResult) { |
68 if (!IsInBound()) | 68 if (!IsInBound()) |
69 return -1; | 69 return -1; |
70 | 70 |
71 *dwResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; | 71 *dwResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; |
72 AdvanceBit(); | 72 AdvanceBit(); |
73 return 0; | 73 return 0; |
74 } | 74 } |
75 | 75 |
76 int32_t CJBig2_BitStream::read1Bit(FX_BOOL* bResult) { | 76 int32_t CJBig2_BitStream::read1Bit(bool* bResult) { |
77 if (!IsInBound()) | 77 if (!IsInBound()) |
78 return -1; | 78 return -1; |
79 | 79 |
80 *bResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; | 80 *bResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; |
81 AdvanceBit(); | 81 AdvanceBit(); |
82 return 0; | 82 return 0; |
83 } | 83 } |
84 | 84 |
85 int32_t CJBig2_BitStream::read1Byte(uint8_t* cResult) { | 85 int32_t CJBig2_BitStream::read1Byte(uint8_t* cResult) { |
86 if (!IsInBound()) | 86 if (!IsInBound()) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return m_dwByteIdx < m_dwLength; | 180 return m_dwByteIdx < m_dwLength; |
181 } | 181 } |
182 | 182 |
183 uint32_t CJBig2_BitStream::LengthInBits() const { | 183 uint32_t CJBig2_BitStream::LengthInBits() const { |
184 return m_dwLength << 3; | 184 return m_dwLength << 3; |
185 } | 185 } |
186 | 186 |
187 uint32_t CJBig2_BitStream::getObjNum() const { | 187 uint32_t CJBig2_BitStream::getObjNum() const { |
188 return m_dwObjNum; | 188 return m_dwObjNum; |
189 } | 189 } |
OLD | NEW |