xref: /aosp_15_r20/external/pdfium/fxbarcode/common/BC_CommonByteMatrix.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1*3ac0a46fSAndroid Build Coastguard Worker // Copyright 2014 The PDFium Authors
2*3ac0a46fSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*3ac0a46fSAndroid Build Coastguard Worker // found in the LICENSE file.
4*3ac0a46fSAndroid Build Coastguard Worker 
5*3ac0a46fSAndroid Build Coastguard Worker // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6*3ac0a46fSAndroid Build Coastguard Worker 
7*3ac0a46fSAndroid Build Coastguard Worker #ifndef FXBARCODE_COMMON_BC_COMMONBYTEMATRIX_H_
8*3ac0a46fSAndroid Build Coastguard Worker #define FXBARCODE_COMMON_BC_COMMONBYTEMATRIX_H_
9*3ac0a46fSAndroid Build Coastguard Worker 
10*3ac0a46fSAndroid Build Coastguard Worker #include <stdint.h>
11*3ac0a46fSAndroid Build Coastguard Worker 
12*3ac0a46fSAndroid Build Coastguard Worker #include "core/fxcrt/data_vector.h"
13*3ac0a46fSAndroid Build Coastguard Worker #include "third_party/base/containers/span.h"
14*3ac0a46fSAndroid Build Coastguard Worker 
15*3ac0a46fSAndroid Build Coastguard Worker class CBC_CommonByteMatrix final {
16*3ac0a46fSAndroid Build Coastguard Worker  public:
17*3ac0a46fSAndroid Build Coastguard Worker   CBC_CommonByteMatrix(size_t width, size_t height);
18*3ac0a46fSAndroid Build Coastguard Worker   ~CBC_CommonByteMatrix();
19*3ac0a46fSAndroid Build Coastguard Worker 
GetWidth()20*3ac0a46fSAndroid Build Coastguard Worker   size_t GetWidth() const { return m_width; }
GetHeight()21*3ac0a46fSAndroid Build Coastguard Worker   size_t GetHeight() const { return m_height; }
GetArray()22*3ac0a46fSAndroid Build Coastguard Worker   pdfium::span<const uint8_t> GetArray() const { return m_bytes; }
23*3ac0a46fSAndroid Build Coastguard Worker   DataVector<uint8_t> TakeArray();
24*3ac0a46fSAndroid Build Coastguard Worker 
25*3ac0a46fSAndroid Build Coastguard Worker   uint8_t Get(size_t x, size_t y) const;
26*3ac0a46fSAndroid Build Coastguard Worker   void Set(size_t x, size_t y, uint8_t value);
27*3ac0a46fSAndroid Build Coastguard Worker   void Fill(uint8_t value);
28*3ac0a46fSAndroid Build Coastguard Worker 
29*3ac0a46fSAndroid Build Coastguard Worker  private:
30*3ac0a46fSAndroid Build Coastguard Worker   const size_t m_width;
31*3ac0a46fSAndroid Build Coastguard Worker   const size_t m_height;
32*3ac0a46fSAndroid Build Coastguard Worker   DataVector<uint8_t> m_bytes;
33*3ac0a46fSAndroid Build Coastguard Worker };
34*3ac0a46fSAndroid Build Coastguard Worker 
35*3ac0a46fSAndroid Build Coastguard Worker #endif  // FXBARCODE_COMMON_BC_COMMONBYTEMATRIX_H_
36