Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Dan Sinclair | e778668 | 2017-03-29 15:18:41 -0400 | [diff] [blame] | 7 | #ifndef FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_ |
| 8 | #define FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_ |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 9 | |
dsinclair | a52ab74 | 2016-09-29 13:59:29 -0700 | [diff] [blame] | 10 | #include "core/fxcrt/fx_system.h" |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 11 | |
| 12 | class CBC_CommonBitArray; |
| 13 | |
| 14 | class CBC_CommonBitMatrix { |
| 15 | public: |
| 16 | CBC_CommonBitMatrix(); |
Lei Zhang | 1b22880 | 2017-04-05 18:42:22 -0700 | [diff] [blame^] | 17 | ~CBC_CommonBitMatrix(); |
weili | 29b8ad0 | 2016-06-14 18:20:04 -0700 | [diff] [blame] | 18 | |
Lei Zhang | 1b22880 | 2017-04-05 18:42:22 -0700 | [diff] [blame^] | 19 | void Init(int32_t dimension); |
| 20 | void Init(int32_t width, int32_t height); |
weili | 29b8ad0 | 2016-06-14 18:20:04 -0700 | [diff] [blame] | 21 | |
Lei Zhang | 1b22880 | 2017-04-05 18:42:22 -0700 | [diff] [blame^] | 22 | bool Get(int32_t x, int32_t y) const; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 23 | void Set(int32_t x, int32_t y); |
| 24 | void Flip(int32_t x, int32_t y); |
| 25 | void Clear(); |
Lei Zhang | 1b22880 | 2017-04-05 18:42:22 -0700 | [diff] [blame^] | 26 | bool SetRegion(int32_t left, int32_t top, int32_t width, int32_t height); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 27 | CBC_CommonBitArray* GetRow(int32_t y, CBC_CommonBitArray* row); |
| 28 | void SetRow(int32_t y, CBC_CommonBitArray* row); |
| 29 | CBC_CommonBitArray* GetCol(int32_t y, CBC_CommonBitArray* row); |
| 30 | void SetCol(int32_t y, CBC_CommonBitArray* col); |
Lei Zhang | 1b22880 | 2017-04-05 18:42:22 -0700 | [diff] [blame^] | 31 | int32_t GetWidth() const; |
| 32 | int32_t GetHeight() const; |
| 33 | int32_t GetRowSize() const; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 34 | int32_t* GetBits(); |
| 35 | |
| 36 | private: |
Lei Zhang | 1b22880 | 2017-04-05 18:42:22 -0700 | [diff] [blame^] | 37 | int32_t m_width = 0; |
| 38 | int32_t m_height = 0; |
| 39 | int32_t m_rowSize = 0; |
| 40 | int32_t* m_bits = nullptr; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 41 | }; |
| 42 | |
Dan Sinclair | e778668 | 2017-03-29 15:18:41 -0400 | [diff] [blame] | 43 | #endif // FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_ |