summaryrefslogtreecommitdiff
path: root/fxbarcode/pdf417/BC_PDF417.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-29 15:18:41 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-29 21:01:07 +0000
commite778668fe92b8c60e0537ee48f79d5af6c1a2f1e (patch)
treece7ce115b6f7306a6363f4a3d26d0de2c5646aea /fxbarcode/pdf417/BC_PDF417.h
parentb929ab0886a2b0ceb701989ef126e5b0cabf6997 (diff)
downloadpdfium-e778668fe92b8c60e0537ee48f79d5af6c1a2f1e.tar.xz
Move xfa/fxbarcode fxbarcode/
Nothing in fxbarcode/ depends on XFA code. This CL moves xfa/fxbarcode to be fxbarcode/ and creates a static_library for fxbarcode which is depend on by the xfa library. Change-Id: I0b708737b07efb94b769a5238d92af92bc62880d Reviewed-on: https://pdfium-review.googlesource.com/3291 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxbarcode/pdf417/BC_PDF417.h')
-rw-r--r--fxbarcode/pdf417/BC_PDF417.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/fxbarcode/pdf417/BC_PDF417.h b/fxbarcode/pdf417/BC_PDF417.h
new file mode 100644
index 0000000000..bc36ea5037
--- /dev/null
+++ b/fxbarcode/pdf417/BC_PDF417.h
@@ -0,0 +1,68 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_PDF417_BC_PDF417_H_
+#define FXBARCODE_PDF417_BC_PDF417_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+#include "fxbarcode/pdf417/BC_PDF417Compaction.h"
+
+class CBC_BarcodeRow;
+class CBC_BarcodeMatrix;
+
+class CBC_PDF417 {
+ public:
+ CBC_PDF417();
+ explicit CBC_PDF417(bool compact);
+ virtual ~CBC_PDF417();
+
+ CBC_BarcodeMatrix* getBarcodeMatrix();
+ void generateBarcodeLogic(CFX_WideString msg,
+ int32_t errorCorrectionLevel,
+ int32_t& e);
+ void setDimensions(int32_t maxCols,
+ int32_t minCols,
+ int32_t maxRows,
+ int32_t minRows);
+ void setCompaction(Compaction compaction);
+ void setCompact(bool compact);
+
+ private:
+ static const int32_t START_PATTERN = 0x1fea8;
+ static const int32_t STOP_PATTERN = 0x3fa29;
+ static const int32_t CODEWORD_TABLE[][929];
+ static constexpr float PREFERRED_RATIO = 3.0f;
+ static constexpr float DEFAULT_MODULE_WIDTH = 0.357f;
+ static constexpr float HEIGHT = 2.0f;
+
+ static int32_t calculateNumberOfRows(int32_t m, int32_t k, int32_t c);
+ static int32_t getNumberOfPadCodewords(int32_t m,
+ int32_t k,
+ int32_t c,
+ int32_t r);
+ static void encodeChar(int32_t pattern, int32_t len, CBC_BarcodeRow* logic);
+ void encodeLowLevel(CFX_WideString fullCodewords,
+ int32_t c,
+ int32_t r,
+ int32_t errorCorrectionLevel,
+ CBC_BarcodeMatrix* logic);
+ std::vector<int32_t>* determineDimensions(int32_t sourceCodeWords,
+ int32_t errorCorrectionCodeWords,
+ int32_t& e);
+
+ std::unique_ptr<CBC_BarcodeMatrix> m_barcodeMatrix;
+ bool m_compact;
+ Compaction m_compaction;
+ int32_t m_minCols;
+ int32_t m_maxCols;
+ int32_t m_maxRows;
+ int32_t m_minRows;
+};
+
+#endif // FXBARCODE_PDF417_BC_PDF417_H_