From b10aff29932d434b3e333f6a92d7d6edf574963d Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Tue, 21 Aug 2018 21:04:26 +0000 Subject: Remove excessive padding above and below PDF417 barcodes. Bug: pdfium:1135 Change-Id: Iea16a65a5eebcb914192eb49de17a2c4eda83320 Reviewed-on: https://pdfium-review.googlesource.com/40690 Commit-Queue: Henrique Nakashima Reviewed-by: Ryan Harrison Reviewed-by: Lei Zhang --- fxbarcode/pdf417/BC_PDF417.cpp | 2 +- fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp | 6 +++--- fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'fxbarcode') diff --git a/fxbarcode/pdf417/BC_PDF417.cpp b/fxbarcode/pdf417/BC_PDF417.cpp index d0ecaccf55..084f3a8810 100644 --- a/fxbarcode/pdf417/BC_PDF417.cpp +++ b/fxbarcode/pdf417/BC_PDF417.cpp @@ -506,7 +506,6 @@ void CBC_PDF417::encodeLowLevel(WideString fullCodewords, int32_t idx = 0; for (int32_t y = 0; y < r; y++) { int32_t cluster = y % 3; - logic->startRow(); encodeChar(START_PATTERN, 17, logic->getCurrentRow()); int32_t left; int32_t right; @@ -534,6 +533,7 @@ void CBC_PDF417::encodeLowLevel(WideString fullCodewords, encodeChar(pattern, 17, logic->getCurrentRow()); encodeChar(STOP_PATTERN, 18, logic->getCurrentRow()); } + logic->nextRow(); } } diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp index ca492b3c19..ebedbf6197 100644 --- a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp +++ b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp @@ -25,12 +25,12 @@ #include "third_party/base/ptr_util.h" CBC_BarcodeMatrix::CBC_BarcodeMatrix(int32_t height, int32_t width) { - m_matrix.resize(height + 2); + m_matrix.resize(height); for (size_t i = 0; i < m_matrix.size(); ++i) m_matrix[i] = pdfium::MakeUnique((width + 4) * 17 + 1); m_width = width * 17; - m_height = height + 2; + m_height = height; m_currentRow = 0; m_outHeight = 0; m_outWidth = 0; @@ -44,7 +44,7 @@ void CBC_BarcodeMatrix::set(int32_t x, int32_t y, uint8_t value) { void CBC_BarcodeMatrix::setMatrix(int32_t x, int32_t y, bool black) { set(x, y, (uint8_t)(black ? 1 : 0)); } -void CBC_BarcodeMatrix::startRow() { +void CBC_BarcodeMatrix::nextRow() { ++m_currentRow; } std::vector& CBC_BarcodeMatrix::getMatrix() { diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h index 71ada98872..4f6591ed55 100644 --- a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h +++ b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h @@ -23,7 +23,7 @@ class CBC_BarcodeMatrix { 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 startRow(); + void nextRow(); std::vector& getMatrix(); std::vector& getScaledMatrix(int32_t scale); std::vector& getScaledMatrix(int32_t xScale, int32_t yScale); -- cgit v1.2.3