summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-08-21 21:04:26 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-21 21:04:26 +0000
commitb10aff29932d434b3e333f6a92d7d6edf574963d (patch)
tree04d715dfe02e9a95038f45450288d4316dac92a8
parent3cfe89d632315b6bdae3264cc75fc5ed06d36f45 (diff)
downloadpdfium-b10aff29932d434b3e333f6a92d7d6edf574963d.tar.xz
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 <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
-rw-r--r--DEPS2
-rw-r--r--fxbarcode/pdf417/BC_PDF417.cpp2
-rw-r--r--fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp6
-rw-r--r--fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h2
-rw-r--r--testing/resources/pixel/xfa_specific/barcode_test_expected.pdf.0.pngbin10669 -> 10663 bytes
-rw-r--r--xfa/fwl/cfx_barcode_unittest.cpp2
6 files changed, 7 insertions, 7 deletions
diff --git a/DEPS b/DEPS
index eed693cba1..a688aef000 100644
--- a/DEPS
+++ b/DEPS
@@ -29,7 +29,7 @@ vars = {
'jinja2_revision': '45571de473282bd1d8b63a8dfcb1fd268d0635d2',
'jpeg_turbo_revision': '7260e4d8b8e1e40b17f03fafdf1cd83296900f76',
'markupsafe_revision': '8f45f5cfa0009d2a70589bcda0349b8cb2b72783',
- 'pdfium_tests_revision': '5d08954b10c09828682c5c26ad8397f36966f8c1',
+ 'pdfium_tests_revision': 'e1005e0e78574669b9fb14f816f12cd7dc72677e',
'skia_revision': '588f879677d4f36e16a42dd96876534f104c2e2f',
'tools_memory_revision': 'f7b00daf4df7f6c469f5fbc68d7f40f6bd15d6e6',
'trace_event_revision': '211b3ed9d0481b4caddbee1322321b86a483ca1f',
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<CBC_BarcodeRow>((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<uint8_t>& 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<uint8_t>& getMatrix();
std::vector<uint8_t>& getScaledMatrix(int32_t scale);
std::vector<uint8_t>& getScaledMatrix(int32_t xScale, int32_t yScale);
diff --git a/testing/resources/pixel/xfa_specific/barcode_test_expected.pdf.0.png b/testing/resources/pixel/xfa_specific/barcode_test_expected.pdf.0.png
index 4138165e64..3ac5671548 100644
--- a/testing/resources/pixel/xfa_specific/barcode_test_expected.pdf.0.png
+++ b/testing/resources/pixel/xfa_specific/barcode_test_expected.pdf.0.png
Binary files differ
diff --git a/xfa/fwl/cfx_barcode_unittest.cpp b/xfa/fwl/cfx_barcode_unittest.cpp
index 38aafeebf8..953bb1cd1f 100644
--- a/xfa/fwl/cfx_barcode_unittest.cpp
+++ b/xfa/fwl/cfx_barcode_unittest.cpp
@@ -131,7 +131,7 @@ TEST_F(BarcodeTest, Pdf417) {
EXPECT_TRUE(Create(BC_PDF417));
EXPECT_TRUE(barcode()->Encode(L"clams"));
RenderDevice();
- EXPECT_EQ("35e94f2da8649fb1402534cc65085999", BitmapChecksum());
+ EXPECT_EQ("191e35d11613901b7d5d51033689aa89", BitmapChecksum());
}
TEST_F(BarcodeTest, DataMatrix) {