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 | |
Tom Sepez | 0804b3f | 2017-05-01 14:06:10 -0700 | [diff] [blame] | 10 | #include <memory> |
| 11 | |
dsinclair | a52ab74 | 2016-09-29 13:59:29 -0700 | [diff] [blame] | 12 | #include "core/fxcrt/fx_system.h" |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 13 | |
| 14 | class CBC_CommonBitArray; |
| 15 | |
| 16 | class CBC_CommonBitMatrix { |
| 17 | public: |
| 18 | CBC_CommonBitMatrix(); |
Lei Zhang | 1b22880 | 2017-04-05 18:42:22 -0700 | [diff] [blame] | 19 | ~CBC_CommonBitMatrix(); |
weili | 29b8ad0 | 2016-06-14 18:20:04 -0700 | [diff] [blame] | 20 | |
Lei Zhang | 1b22880 | 2017-04-05 18:42:22 -0700 | [diff] [blame] | 21 | void Init(int32_t dimension); |
| 22 | void Init(int32_t width, int32_t height); |
weili | 29b8ad0 | 2016-06-14 18:20:04 -0700 | [diff] [blame] | 23 | |
Lei Zhang | 1b22880 | 2017-04-05 18:42:22 -0700 | [diff] [blame] | 24 | bool Get(int32_t x, int32_t y) const; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 25 | void Set(int32_t x, int32_t y); |
| 26 | void Flip(int32_t x, int32_t y); |
| 27 | void Clear(); |
Lei Zhang | 1b22880 | 2017-04-05 18:42:22 -0700 | [diff] [blame] | 28 | 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] | 29 | void SetRow(int32_t y, CBC_CommonBitArray* row); |
| 30 | CBC_CommonBitArray* GetCol(int32_t y, CBC_CommonBitArray* row); |
| 31 | void SetCol(int32_t y, CBC_CommonBitArray* col); |
Tom Sepez | 0804b3f | 2017-05-01 14:06:10 -0700 | [diff] [blame] | 32 | int32_t GetWidth() const { return m_width; } |
| 33 | int32_t GetHeight() const { return m_height; } |
| 34 | int32_t* GetBits() const { return m_bits; } |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 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_ |