From 3b45012d57884b06915eb5a1f54fbba04a45e807 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Thu, 23 Aug 2018 20:47:16 +0000 Subject: Remove CBC_BarcodeMatrix::m_matrixOut and just return the bit array. Change-Id: I12893784321f92e5cac2b80653897007b6e63c7e Reviewed-on: https://pdfium-review.googlesource.com/41111 Commit-Queue: Henrique Nakashima Reviewed-by: Lei Zhang --- fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp | 8 ++++---- fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h | 3 +-- fxbarcode/pdf417/BC_PDF417Writer.cpp | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp index 1d05486f30..70e7cd9598 100644 --- a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp +++ b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp @@ -33,12 +33,12 @@ CBC_BarcodeMatrix::CBC_BarcodeMatrix(size_t width, size_t height) CBC_BarcodeMatrix::~CBC_BarcodeMatrix() {} -std::vector& CBC_BarcodeMatrix::getMatrix() { - m_matrixOut.resize(m_width * m_height); +std::vector CBC_BarcodeMatrix::toBitArray() { + std::vector bitArray(m_width * m_height); for (size_t i = 0; i < m_height; ++i) { std::vector& bytearray = m_matrix[i]->getRow(); for (size_t j = 0; j < m_width; ++j) - m_matrixOut[i * m_width + j] = bytearray[j]; + bitArray[i * m_width + j] = bytearray[j]; } - return m_matrixOut; + return bitArray; } diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h index 1359ac2e63..60978391cb 100644 --- a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h +++ b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h @@ -20,11 +20,10 @@ class CBC_BarcodeMatrix { CBC_BarcodeRow* getRow(size_t row) const { return m_matrix[row].get(); } size_t getWidth() const { return m_width; } size_t getHeight() const { return m_height; } - std::vector& getMatrix(); + std::vector toBitArray(); private: std::vector> m_matrix; - std::vector m_matrixOut; size_t m_width; size_t m_height; }; diff --git a/fxbarcode/pdf417/BC_PDF417Writer.cpp b/fxbarcode/pdf417/BC_PDF417Writer.cpp index 129d59c393..479bc2cd85 100644 --- a/fxbarcode/pdf417/BC_PDF417Writer.cpp +++ b/fxbarcode/pdf417/BC_PDF417Writer.cpp @@ -62,7 +62,7 @@ uint8_t* CBC_PDF417Writer::Encode(const WideString& contents, return nullptr; CBC_BarcodeMatrix* barcodeMatrix = encoder.getBarcodeMatrix(); - std::vector matrixData = barcodeMatrix->getMatrix(); + std::vector matrixData = barcodeMatrix->toBitArray(); int32_t matrixWidth = barcodeMatrix->getWidth(); int32_t matrixHeight = barcodeMatrix->getHeight(); -- cgit v1.2.3