summaryrefslogtreecommitdiff
path: root/fxbarcode/pdf417
diff options
context:
space:
mode:
Diffstat (limited to 'fxbarcode/pdf417')
-rw-r--r--fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp9
-rw-r--r--fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h2
-rw-r--r--fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp14
-rw-r--r--fxbarcode/pdf417/BC_PDF417BarcodeRow.h2
4 files changed, 7 insertions, 20 deletions
diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
index ebedbf6197..58357b22de 100644
--- a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
+++ b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
@@ -38,21 +38,18 @@ CBC_BarcodeMatrix::CBC_BarcodeMatrix(int32_t height, int32_t width) {
CBC_BarcodeMatrix::~CBC_BarcodeMatrix() {}
-void CBC_BarcodeMatrix::set(int32_t x, int32_t y, uint8_t value) {
- m_matrix[y]->set(x, value);
-}
-void CBC_BarcodeMatrix::setMatrix(int32_t x, int32_t y, bool black) {
- set(x, y, (uint8_t)(black ? 1 : 0));
-}
void CBC_BarcodeMatrix::nextRow() {
++m_currentRow;
}
+
std::vector<uint8_t>& CBC_BarcodeMatrix::getMatrix() {
return getScaledMatrix(1, 1);
}
+
std::vector<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale) {
return getScaledMatrix(scale, scale);
}
+
std::vector<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale,
int32_t yScale) {
size_t yMax = m_height * yScale;
diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
index 4f6591ed55..38744471ba 100644
--- a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
+++ b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
@@ -21,8 +21,6 @@ class CBC_BarcodeMatrix {
CBC_BarcodeRow* getCurrentRow() const { return m_matrix[m_currentRow].get(); }
int32_t getWidth() const { return m_outWidth; }
int32_t getHeight() const { return m_outHeight; }
- void set(int32_t x, int32_t y, uint8_t value);
- void setMatrix(int32_t x, int32_t y, bool black);
void nextRow();
std::vector<uint8_t>& getMatrix();
std::vector<uint8_t>& getScaledMatrix(int32_t scale);
diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp b/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
index c0c251f708..ee54a273dd 100644
--- a/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
+++ b/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
@@ -22,22 +22,16 @@
#include "fxbarcode/pdf417/BC_PDF417BarcodeRow.h"
+#include <algorithm>
+
CBC_BarcodeRow::CBC_BarcodeRow(size_t width)
: m_row(width), m_currentLocation(0) {}
CBC_BarcodeRow::~CBC_BarcodeRow() {}
-void CBC_BarcodeRow::set(int32_t x, uint8_t value) {
- m_row[x] = value;
-}
-
-void CBC_BarcodeRow::set(int32_t x, bool black) {
- m_row[x] = black ? 1 : 0;
-}
-
void CBC_BarcodeRow::addBar(bool black, int32_t width) {
- for (int32_t ii = 0; ii < width; ii++)
- set(m_currentLocation++, black);
+ std::fill_n(m_row.begin() + m_currentLocation, width, black ? 1 : 0);
+ m_currentLocation += width;
}
std::vector<uint8_t>& CBC_BarcodeRow::getRow() {
diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeRow.h b/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
index d49d0eb9c2..a07d5770b3 100644
--- a/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
+++ b/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
@@ -16,8 +16,6 @@ class CBC_BarcodeRow {
explicit CBC_BarcodeRow(size_t width);
virtual ~CBC_BarcodeRow();
- void set(int32_t x, uint8_t value);
- void set(int32_t x, bool black);
void addBar(bool black, int32_t width);
std::vector<uint8_t>& getRow();
std::vector<uint8_t>& getScaledRow(int32_t scale);