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 7 #ifndef FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_ 8 #define FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_ 9 10 #include <memory> 11 12 #include "core/fxcrt/fx_system.h" 13 14 class CBC_CommonBitArray; 15 16 class CBC_CommonBitMatrix { 17 public: 18 CBC_CommonBitMatrix(); 19 ~CBC_CommonBitMatrix(); 20 21 void Init(int32_t dimension); 22 void Init(int32_t width, int32_t height); 23 24 bool Get(int32_t x, int32_t y) const; 25 void Set(int32_t x, int32_t y); 26 void Flip(int32_t x, int32_t y); 27 void Clear(); 28 bool SetRegion(int32_t left, int32_t top, int32_t width, int32_t height); 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); GetWidth()32 int32_t GetWidth() const { return m_width; } GetHeight()33 int32_t GetHeight() const { return m_height; } GetBits()34 int32_t* GetBits() const { return m_bits; } 35 36 private: 37 int32_t m_width = 0; 38 int32_t m_height = 0; 39 int32_t m_rowSize = 0; 40 int32_t* m_bits = nullptr; 41 }; 42 43 #endif // FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_ 44