summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/pdf417
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxbarcode/pdf417')
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417.cpp12
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417.h7
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp10
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h8
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp4
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h8
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp6
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h11
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp2
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp6
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417Writer.h4
11 files changed, 41 insertions, 37 deletions
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.cpp b/xfa/fxbarcode/pdf417/BC_PDF417.cpp
index 9b8d0c149c..16ed6fdf12 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417.cpp
@@ -410,7 +410,7 @@ void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg,
CBC_PDF417HighLevelEncoder::encodeHighLevel(msg, m_compaction, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
int32_t sourceCodeWords = highLevel.GetLength();
- CFX_Int32Array* dimension =
+ CFX_ArrayTemplate<int32_t>* dimension =
determineDimensions(sourceCodeWords, errorCorrectionCodeWords, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
int32_t cols = dimension->GetAt(0);
@@ -532,12 +532,12 @@ void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords,
}
}
-CFX_Int32Array* CBC_PDF417::determineDimensions(
+CFX_ArrayTemplate<int32_t>* CBC_PDF417::determineDimensions(
int32_t sourceCodeWords,
int32_t errorCorrectionCodeWords,
int32_t& e) {
FX_FLOAT ratio = 0.0f;
- CFX_Int32Array* dimension = nullptr;
+ CFX_ArrayTemplate<int32_t>* dimension = nullptr;
for (int32_t cols = m_minCols; cols <= m_maxCols; cols++) {
int32_t rows =
calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols);
@@ -555,7 +555,7 @@ CFX_Int32Array* CBC_PDF417::determineDimensions(
}
ratio = newRatio;
delete dimension;
- dimension = new CFX_Int32Array;
+ dimension = new CFX_ArrayTemplate<int32_t>;
dimension->Add(cols);
dimension->Add(rows);
}
@@ -563,11 +563,11 @@ CFX_Int32Array* CBC_PDF417::determineDimensions(
int32_t rows = calculateNumberOfRows(sourceCodeWords,
errorCorrectionCodeWords, m_minCols);
if (rows < m_minRows) {
- dimension = new CFX_Int32Array;
+ dimension = new CFX_ArrayTemplate<int32_t>;
dimension->Add(m_minCols);
dimension->Add(m_minRows);
} else if (rows >= 3 && rows <= 90) {
- dimension = new CFX_Int32Array;
+ dimension = new CFX_ArrayTemplate<int32_t>;
dimension->Add(m_minCols);
dimension->Add(rows);
}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.h b/xfa/fxbarcode/pdf417/BC_PDF417.h
index 5f7c2d49b9..3ba5aa2f0c 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417.h
@@ -51,9 +51,10 @@ class CBC_PDF417 {
int32_t r,
int32_t errorCorrectionLevel,
CBC_BarcodeMatrix* logic);
- CFX_Int32Array* determineDimensions(int32_t sourceCodeWords,
- int32_t errorCorrectionCodeWords,
- int32_t& e);
+ CFX_ArrayTemplate<int32_t>* determineDimensions(
+ int32_t sourceCodeWords,
+ int32_t errorCorrectionCodeWords,
+ int32_t& e);
std::unique_ptr<CBC_BarcodeMatrix> m_barcodeMatrix;
bool m_compact;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
index f348d2c934..c1f4da1e3b 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
@@ -59,16 +59,16 @@ int32_t CBC_BarcodeMatrix::getWidth() {
int32_t CBC_BarcodeMatrix::getHeight() {
return m_outHeight;
}
-CFX_ByteArray& CBC_BarcodeMatrix::getMatrix() {
+CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getMatrix() {
return getScaledMatrix(1, 1);
}
-CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale) {
+CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale) {
return getScaledMatrix(scale, scale);
}
-CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale,
- int32_t yScale) {
+CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale,
+ int32_t yScale) {
int32_t yMax = m_height * yScale;
- CFX_ByteArray bytearray;
+ CFX_ArrayTemplate<uint8_t> bytearray;
bytearray.Copy(m_matrix[0]->getScaledRow(xScale));
int32_t xMax = bytearray.GetSize();
m_matrixOut.SetSize(xMax * yMax);
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
index 0f6922233d..95ab547c90 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
@@ -21,15 +21,15 @@ class CBC_BarcodeMatrix {
void setMatrix(int32_t x, int32_t y, bool black);
void startRow();
CBC_BarcodeRow* getCurrentRow();
- CFX_ByteArray& getMatrix();
- CFX_ByteArray& getScaledMatrix(int32_t scale);
- CFX_ByteArray& getScaledMatrix(int32_t xScale, int32_t yScale);
+ CFX_ArrayTemplate<uint8_t>& getMatrix();
+ CFX_ArrayTemplate<uint8_t>& getScaledMatrix(int32_t scale);
+ CFX_ArrayTemplate<uint8_t>& getScaledMatrix(int32_t xScale, int32_t yScale);
int32_t getWidth();
int32_t getHeight();
private:
CFX_ArrayTemplate<CBC_BarcodeRow*> m_matrix;
- CFX_ByteArray m_matrixOut;
+ CFX_ArrayTemplate<uint8_t> m_matrixOut;
int32_t m_currentRow;
int32_t m_height;
int32_t m_width;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
index b721ffc3ef..243af70d94 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
@@ -41,10 +41,10 @@ void CBC_BarcodeRow::addBar(bool black, int32_t width) {
set(m_currentLocation++, black);
}
}
-CFX_ByteArray& CBC_BarcodeRow::getRow() {
+CFX_ArrayTemplate<uint8_t>& CBC_BarcodeRow::getRow() {
return m_row;
}
-CFX_ByteArray& CBC_BarcodeRow::getScaledRow(int32_t scale) {
+CFX_ArrayTemplate<uint8_t>& CBC_BarcodeRow::getScaledRow(int32_t scale) {
m_output.SetSize(m_row.GetSize() * scale);
for (int32_t i = 0; i < m_output.GetSize(); i++) {
m_output[i] = (m_row[i / scale]);
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
index 90e76ac50a..7d9d19cb56 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
@@ -17,12 +17,12 @@ class CBC_BarcodeRow {
void set(int32_t x, uint8_t value);
void set(int32_t x, bool black);
void addBar(bool black, int32_t width);
- CFX_ByteArray& getRow();
- CFX_ByteArray& getScaledRow(int32_t scale);
+ CFX_ArrayTemplate<uint8_t>& getRow();
+ CFX_ArrayTemplate<uint8_t>& getScaledRow(int32_t scale);
private:
- CFX_ByteArray m_row;
- CFX_ByteArray m_output;
+ CFX_ArrayTemplate<uint8_t> m_row;
+ CFX_ArrayTemplate<uint8_t> m_output;
int32_t m_currentLocation;
};
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
index fa0e9bc67d..183566f9e3 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
@@ -71,7 +71,7 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(
}
msg += ch;
}
- CFX_ByteArray byteArr;
+ CFX_ArrayTemplate<uint8_t> byteArr;
for (int32_t k = 0; k < bytes.GetLength(); k++) {
byteArr.Add(bytes.GetAt(k));
}
@@ -260,7 +260,7 @@ int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg,
}
return submode;
}
-void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ByteArray* bytes,
+void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes,
int32_t startpos,
int32_t count,
int32_t startmode,
@@ -387,7 +387,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(
}
int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(
CFX_WideString msg,
- CFX_ByteArray* bytes,
+ CFX_ArrayTemplate<uint8_t>* bytes,
int32_t startpos,
int32_t& e) {
int32_t len = msg.GetLength();
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
index 39abe0f1df..38382c891c 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
@@ -39,7 +39,7 @@ class CBC_PDF417HighLevelEncoder {
int32_t count,
CFX_WideString& sb,
int32_t initialSubmode);
- static void encodeBinary(CFX_ByteArray* bytes,
+ static void encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes,
int32_t startpos,
int32_t count,
int32_t startmode,
@@ -58,10 +58,11 @@ class CBC_PDF417HighLevelEncoder {
int32_t startpos);
static int32_t determineConsecutiveTextCount(CFX_WideString msg,
int32_t startpos);
- static int32_t determineConsecutiveBinaryCount(CFX_WideString msg,
- CFX_ByteArray* bytes,
- int32_t startpos,
- int32_t& e);
+ static int32_t determineConsecutiveBinaryCount(
+ CFX_WideString msg,
+ CFX_ArrayTemplate<uint8_t>* bytes,
+ int32_t startpos,
+ int32_t& e);
friend class PDF417HighLevelEncoder_EncodeNumeric_Test;
friend class PDF417HighLevelEncoder_EncodeBinary_Test;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
index a1b753e3ee..2cd60fef41 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
@@ -43,7 +43,7 @@ TEST(PDF417HighLevelEncoder, EncodeBinary) {
CBC_PDF417HighLevelEncoder::Initialize();
for (size_t i = 0; i < FX_ArraySize(encode_binary_cases); ++i) {
EncodeBinaryCase* ptr = &encode_binary_cases[i];
- CFX_ByteArray input_array;
+ CFX_ArrayTemplate<uint8_t> input_array;
size_t input_length = strlen(ptr->input);
input_array.SetSize(input_length);
for (size_t j = 0; j < input_length; ++j) {
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp b/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp
index 4c9b5cb15c..72d1a05dfd 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp
@@ -63,7 +63,7 @@ uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents,
int32_t lineThickness = 2;
int32_t aspectRatio = 4;
CBC_BarcodeMatrix* barcodeMatrix = encoder.getBarcodeMatrix();
- CFX_ByteArray originalScale;
+ CFX_ArrayTemplate<uint8_t> originalScale;
originalScale.Copy(barcodeMatrix->getScaledMatrix(
lineThickness, aspectRatio * lineThickness));
int32_t width = outWidth;
@@ -101,10 +101,10 @@ uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents,
FXSYS_memcpy(result, originalScale.GetData(), outHeight * outWidth);
return result;
}
-void CBC_PDF417Writer::rotateArray(CFX_ByteArray& bitarray,
+void CBC_PDF417Writer::rotateArray(CFX_ArrayTemplate<uint8_t>& bitarray,
int32_t height,
int32_t width) {
- CFX_ByteArray temp;
+ CFX_ArrayTemplate<uint8_t> temp;
temp.Copy(bitarray);
for (int32_t ii = 0; ii < height; ii++) {
int32_t inverseii = height - ii - 1;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Writer.h b/xfa/fxbarcode/pdf417/BC_PDF417Writer.h
index 178d251bfe..420c441bc9 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417Writer.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417Writer.h
@@ -27,7 +27,9 @@ class CBC_PDF417Writer : public CBC_TwoDimWriter {
void SetTruncated(bool truncated);
private:
- void rotateArray(CFX_ByteArray& bitarray, int32_t width, int32_t height);
+ void rotateArray(CFX_ArrayTemplate<uint8_t>& bitarray,
+ int32_t width,
+ int32_t height);
bool m_bTruncated;
};