summaryrefslogtreecommitdiff
path: root/fxbarcode
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-08-16 20:15:41 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-16 20:15:41 +0000
commit0a4445ad1c3d76f8eb1b6b3e443a9a731430c237 (patch)
treeb25ad83c3240a49be12add4215deec90749b5136 /fxbarcode
parent5f80ff49403645dc574296bb8b29fe44a2193c3c (diff)
downloadpdfium-0a4445ad1c3d76f8eb1b6b3e443a9a731430c237.tar.xz
Allow PDF417 barcodes to reduce modules by shaving off padding.
The way it was working before is: Look at the width and height provided for the barcode. If the maximum number of codewords to fit in that space was within the spec limits (1 <= cols <= 30 and 3 <= rows <= 90), cram as many codewords as possible. The unused space was filled with padding. With this CL, instead look at the amount of content that needs to fit into the barcode and favor fewer codewords rather than as many as possible. Bug: pdfium:1135 Change-Id: Ia96be82ec7c5f4f920cff58def1a44000bf04761 Reviewed-on: https://pdfium-review.googlesource.com/40350 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fxbarcode')
-rw-r--r--fxbarcode/pdf417/BC_PDF417Writer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/fxbarcode/pdf417/BC_PDF417Writer.cpp b/fxbarcode/pdf417/BC_PDF417Writer.cpp
index 026c89a59d..ca96f69926 100644
--- a/fxbarcode/pdf417/BC_PDF417Writer.cpp
+++ b/fxbarcode/pdf417/BC_PDF417Writer.cpp
@@ -55,7 +55,7 @@ uint8_t* CBC_PDF417Writer::Encode(const WideString& contents,
int32_t col = (m_Width / m_ModuleWidth - 69) / 17;
int32_t row = m_Height / (m_ModuleWidth * 20);
if (row >= 3 && row <= 90 && col >= 1 && col <= 30)
- encoder.setDimensions(col, col, row, row);
+ encoder.setDimensions(col, 1, row, 3);
else if (col >= 1 && col <= 30)
encoder.setDimensions(col, col, 90, 3);
else if (row >= 3 && row <= 90)