blob: 67c0f888cc4ac91db8488be5223124b0d672479b [file] [log] [blame]
Dan Sinclair1770c022016-03-14 14:14:16 -04001// 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 Sinclaire7786682017-03-29 15:18:41 -04007#ifndef FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_
8#define FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_
Dan Sinclair1770c022016-03-14 14:14:16 -04009
Tom Sepez0804b3f2017-05-01 14:06:10 -070010#include <memory>
11
dsinclaira52ab742016-09-29 13:59:29 -070012#include "core/fxcrt/fx_system.h"
Dan Sinclair1770c022016-03-14 14:14:16 -040013
14class CBC_CommonBitArray;
15
16class CBC_CommonBitMatrix {
17 public:
18 CBC_CommonBitMatrix();
Lei Zhang1b228802017-04-05 18:42:22 -070019 ~CBC_CommonBitMatrix();
weili29b8ad02016-06-14 18:20:04 -070020
Lei Zhang1b228802017-04-05 18:42:22 -070021 void Init(int32_t dimension);
22 void Init(int32_t width, int32_t height);
weili29b8ad02016-06-14 18:20:04 -070023
Lei Zhang1b228802017-04-05 18:42:22 -070024 bool Get(int32_t x, int32_t y) const;
Dan Sinclair1770c022016-03-14 14:14:16 -040025 void Set(int32_t x, int32_t y);
26 void Flip(int32_t x, int32_t y);
27 void Clear();
Lei Zhang1b228802017-04-05 18:42:22 -070028 bool SetRegion(int32_t left, int32_t top, int32_t width, int32_t height);
Dan Sinclair1770c022016-03-14 14:14:16 -040029 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 Sepez0804b3f2017-05-01 14:06:10 -070032 int32_t GetWidth() const { return m_width; }
33 int32_t GetHeight() const { return m_height; }
34 int32_t* GetBits() const { return m_bits; }
Dan Sinclair1770c022016-03-14 14:14:16 -040035
36 private:
Lei Zhang1b228802017-04-05 18:42:22 -070037 int32_t m_width = 0;
38 int32_t m_height = 0;
39 int32_t m_rowSize = 0;
40 int32_t* m_bits = nullptr;
Dan Sinclair1770c022016-03-14 14:14:16 -040041};
42
Dan Sinclaire7786682017-03-29 15:18:41 -040043#endif // FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_