1 // Copyright 2014 The PDFium Authors 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_COMMONBYTEMATRIX_H_ 8 #define FXBARCODE_COMMON_BC_COMMONBYTEMATRIX_H_ 9 10 #include <stdint.h> 11 12 #include "core/fxcrt/data_vector.h" 13 #include "third_party/base/containers/span.h" 14 15 class CBC_CommonByteMatrix final { 16 public: 17 CBC_CommonByteMatrix(size_t width, size_t height); 18 ~CBC_CommonByteMatrix(); 19 GetWidth()20 size_t GetWidth() const { return m_width; } GetHeight()21 size_t GetHeight() const { return m_height; } GetArray()22 pdfium::span<const uint8_t> GetArray() const { return m_bytes; } 23 DataVector<uint8_t> TakeArray(); 24 25 uint8_t Get(size_t x, size_t y) const; 26 void Set(size_t x, size_t y, uint8_t value); 27 void Fill(uint8_t value); 28 29 private: 30 const size_t m_width; 31 const size_t m_height; 32 DataVector<uint8_t> m_bytes; 33 }; 34 35 #endif // FXBARCODE_COMMON_BC_COMMONBYTEMATRIX_H_ 36