summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxbarcode')
-rw-r--r--xfa/fxbarcode/BC_ResultPoint.cpp31
-rw-r--r--xfa/fxbarcode/BC_ResultPoint.h25
-rw-r--r--xfa/fxbarcode/common/BC_CommonBitSource.cpp71
-rw-r--r--xfa/fxbarcode/common/BC_CommonBitSource.h28
-rw-r--r--xfa/fxbarcode/common/BC_CommonPerspectiveTransform.cpp152
-rw-r--r--xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h66
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417Codeword.cpp70
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417Codeword.h38
8 files changed, 0 insertions, 481 deletions
diff --git a/xfa/fxbarcode/BC_ResultPoint.cpp b/xfa/fxbarcode/BC_ResultPoint.cpp
deleted file mode 100644
index 9726ea4240..0000000000
--- a/xfa/fxbarcode/BC_ResultPoint.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_ResultPoint.h"
-
-CBC_ResultPoint::CBC_ResultPoint(FX_FLOAT x, FX_FLOAT y) : m_x(x), m_y(y) {}
-FX_FLOAT CBC_ResultPoint::GetX() {
- return m_x;
-}
-FX_FLOAT CBC_ResultPoint::GetY() {
- return m_y;
-}
diff --git a/xfa/fxbarcode/BC_ResultPoint.h b/xfa/fxbarcode/BC_ResultPoint.h
deleted file mode 100644
index 81e27848ca..0000000000
--- a/xfa/fxbarcode/BC_ResultPoint.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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 XFA_FXBARCODE_BC_RESULTPOINT_H_
-#define XFA_FXBARCODE_BC_RESULTPOINT_H_
-
-#include "core/fxcrt/include/fx_basic.h"
-
-class CBC_ResultPoint {
- public:
- CBC_ResultPoint();
- CBC_ResultPoint(FX_FLOAT x, FX_FLOAT y);
- virtual ~CBC_ResultPoint() {}
- virtual FX_FLOAT GetX();
- virtual FX_FLOAT GetY();
-
- protected:
- FX_FLOAT m_x;
- FX_FLOAT m_y;
-};
-
-#endif // XFA_FXBARCODE_BC_RESULTPOINT_H_
diff --git a/xfa/fxbarcode/common/BC_CommonBitSource.cpp b/xfa/fxbarcode/common/BC_CommonBitSource.cpp
deleted file mode 100644
index af91d5e0bd..0000000000
--- a/xfa/fxbarcode/common/BC_CommonBitSource.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/BC_CommonBitSource.h"
-
-CBC_CommonBitSource::CBC_CommonBitSource(CFX_ByteArray* bytes) {
- m_bytes.Copy((*bytes));
- m_bitOffset = 0;
- m_byteOffset = 0;
-}
-CBC_CommonBitSource::~CBC_CommonBitSource() {}
-int32_t CBC_CommonBitSource::ReadBits(int32_t numBits, int32_t& e) {
- if (numBits < 1 || numBits > 32) {
- e = BCExceptionIllegalArgument;
- return 0;
- }
- int32_t result = 0;
- if (m_bitOffset > 0) {
- int32_t bitsLeft = 8 - m_bitOffset;
- int32_t toRead = numBits < bitsLeft ? numBits : bitsLeft;
- int32_t bitsToNotRead = bitsLeft - toRead;
- int32_t mask = (0xff >> (8 - toRead)) << bitsToNotRead;
- result = (m_bytes[m_byteOffset] & mask) >> bitsToNotRead;
- numBits -= toRead;
- m_bitOffset += toRead;
- if (m_bitOffset == 8) {
- m_bitOffset = 0;
- m_byteOffset++;
- }
- }
- if (numBits > 0) {
- while (numBits >= 8) {
- result = (result << 8) | (m_bytes[m_byteOffset] & 0xff);
- m_byteOffset++;
- numBits -= 8;
- }
- if (numBits > 0) {
- int32_t bitsToNotRead = 8 - numBits;
- int32_t mask = (0xff >> bitsToNotRead) << bitsToNotRead;
- result = (result << numBits) |
- ((m_bytes[m_byteOffset] & mask) >> bitsToNotRead);
- m_bitOffset += numBits;
- }
- }
- return result;
-}
-int32_t CBC_CommonBitSource::Available() {
- return 8 * (m_bytes.GetSize() - m_byteOffset) - m_bitOffset;
-}
-int32_t CBC_CommonBitSource::getByteOffset() {
- return m_byteOffset;
-}
diff --git a/xfa/fxbarcode/common/BC_CommonBitSource.h b/xfa/fxbarcode/common/BC_CommonBitSource.h
deleted file mode 100644
index 7c6736cba3..0000000000
--- a/xfa/fxbarcode/common/BC_CommonBitSource.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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 XFA_FXBARCODE_COMMON_BC_COMMONBITSOURCE_H_
-#define XFA_FXBARCODE_COMMON_BC_COMMONBITSOURCE_H_
-
-#include "core/fxcrt/include/fx_basic.h"
-#include "xfa/fxbarcode/utils.h"
-
-class CBC_CommonBitSource {
- public:
- CBC_CommonBitSource(CFX_ByteArray* bytes);
- ~CBC_CommonBitSource();
-
- int32_t ReadBits(int32_t numBits, int32_t& e);
- int32_t Available();
- int32_t getByteOffset();
-
- private:
- CFX_ByteArray m_bytes;
- int32_t m_byteOffset;
- int32_t m_bitOffset;
-};
-
-#endif // XFA_FXBARCODE_COMMON_BC_COMMONBITSOURCE_H_
diff --git a/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.cpp b/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.cpp
deleted file mode 100644
index d84ed6163d..0000000000
--- a/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-// 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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h"
-
-#include <memory>
-
-#include "core/fxcrt/include/fx_basic.h"
-#include "xfa/fxbarcode/utils.h"
-
-CBC_CommonPerspectiveTransform::CBC_CommonPerspectiveTransform(FX_FLOAT a11,
- FX_FLOAT a21,
- FX_FLOAT a31,
- FX_FLOAT a12,
- FX_FLOAT a22,
- FX_FLOAT a32,
- FX_FLOAT a13,
- FX_FLOAT a23,
- FX_FLOAT a33)
- : m_a11(a11),
- m_a12(a12),
- m_a13(a13),
- m_a21(a21),
- m_a22(a22),
- m_a23(a23),
- m_a31(a31),
- m_a32(a32),
- m_a33(a33) {}
-CBC_CommonPerspectiveTransform::~CBC_CommonPerspectiveTransform() {}
-CBC_CommonPerspectiveTransform*
-CBC_CommonPerspectiveTransform::QuadrilateralToQuadrilateral(FX_FLOAT x0,
- FX_FLOAT y0,
- FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- FX_FLOAT x3,
- FX_FLOAT y3,
- FX_FLOAT x0p,
- FX_FLOAT y0p,
- FX_FLOAT x1p,
- FX_FLOAT y1p,
- FX_FLOAT x2p,
- FX_FLOAT y2p,
- FX_FLOAT x3p,
- FX_FLOAT y3p) {
- std::unique_ptr<CBC_CommonPerspectiveTransform> qToS(
- QuadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3));
- std::unique_ptr<CBC_CommonPerspectiveTransform> sToQ(
- SquareToQuadrilateral(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p));
- return sToQ->Times(*(qToS.get()));
-}
-void CBC_CommonPerspectiveTransform::TransformPoints(CFX_FloatArray* points) {
- int32_t max = points->GetSize();
- FX_FLOAT a11 = m_a11;
- FX_FLOAT a12 = m_a12;
- FX_FLOAT a13 = m_a13;
- FX_FLOAT a21 = m_a21;
- FX_FLOAT a22 = m_a22;
- FX_FLOAT a23 = m_a23;
- FX_FLOAT a31 = m_a31;
- FX_FLOAT a32 = m_a32;
- FX_FLOAT a33 = m_a33;
- int32_t i;
- for (i = 0; i < max; i += 2) {
- FX_FLOAT x = (*points)[i];
- FX_FLOAT y = (*points)[i + 1];
- FX_FLOAT denominator = a13 * x + a23 * y + a33;
- (*points)[i] = (a11 * x + a21 * y + a31) / denominator;
- (*points)[i + 1] = (a12 * x + a22 * y + a32) / denominator;
- }
-}
-CBC_CommonPerspectiveTransform*
-CBC_CommonPerspectiveTransform::SquareToQuadrilateral(FX_FLOAT x0,
- FX_FLOAT y0,
- FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- FX_FLOAT x3,
- FX_FLOAT y3) {
- FX_FLOAT dy2 = y3 - y2;
- FX_FLOAT dy3 = y0 - y1 + y2 - y3;
- if ((dy2 == 0.0f) && (dy3 == 0.0f)) {
- return new CBC_CommonPerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0,
- y2 - y1, y0, 0.0f, 0.0f, 1.0f);
- } else {
- FX_FLOAT dx1 = x1 - x2;
- FX_FLOAT dx2 = x3 - x2;
- FX_FLOAT dx3 = x0 - x1 + x2 - x3;
- FX_FLOAT dy1 = y1 - y2;
- FX_FLOAT denominator = dx1 * dy2 - dx2 * dy1;
- FX_FLOAT a13 = (dx3 * dy2 - dx2 * dy3) / denominator;
- FX_FLOAT a23 = (dx1 * dy3 - dx3 * dy1) / denominator;
- return new CBC_CommonPerspectiveTransform(
- x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0 + a13 * y1,
- y3 - y0 + a23 * y3, y0, a13, a23, 1.0f);
- }
-}
-CBC_CommonPerspectiveTransform*
-CBC_CommonPerspectiveTransform::QuadrilateralToSquare(FX_FLOAT x0,
- FX_FLOAT y0,
- FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- FX_FLOAT x3,
- FX_FLOAT y3) {
- std::unique_ptr<CBC_CommonPerspectiveTransform> temp1(
- SquareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3));
- return temp1->BuildAdjoint();
-}
-CBC_CommonPerspectiveTransform* CBC_CommonPerspectiveTransform::BuildAdjoint() {
- return new CBC_CommonPerspectiveTransform(
- m_a22 * m_a33 - m_a23 * m_a32, m_a23 * m_a31 - m_a21 * m_a33,
- m_a21 * m_a32 - m_a22 * m_a31, m_a13 * m_a32 - m_a12 * m_a33,
- m_a11 * m_a33 - m_a13 * m_a31, m_a12 * m_a31 - m_a11 * m_a32,
- m_a12 * m_a23 - m_a13 * m_a22, m_a13 * m_a21 - m_a11 * m_a23,
- m_a11 * m_a22 - m_a12 * m_a21);
-}
-CBC_CommonPerspectiveTransform* CBC_CommonPerspectiveTransform::Times(
- CBC_CommonPerspectiveTransform& other) {
- return new CBC_CommonPerspectiveTransform(
- m_a11 * other.m_a11 + m_a21 * other.m_a12 + m_a31 * other.m_a13,
- m_a11 * other.m_a21 + m_a21 * other.m_a22 + m_a31 * other.m_a23,
- m_a11 * other.m_a31 + m_a21 * other.m_a32 + m_a31 * other.m_a33,
- m_a12 * other.m_a11 + m_a22 * other.m_a12 + m_a32 * other.m_a13,
- m_a12 * other.m_a21 + m_a22 * other.m_a22 + m_a32 * other.m_a23,
- m_a12 * other.m_a31 + m_a22 * other.m_a32 + m_a32 * other.m_a33,
- m_a13 * other.m_a11 + m_a23 * other.m_a12 + m_a33 * other.m_a13,
- m_a13 * other.m_a21 + m_a23 * other.m_a22 + m_a33 * other.m_a23,
- m_a13 * other.m_a31 + m_a23 * other.m_a32 + m_a33 * other.m_a33);
-}
diff --git a/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h b/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h
deleted file mode 100644
index 8a5fd26f22..0000000000
--- a/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// 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 XFA_FXBARCODE_COMMON_BC_COMMONPERSPECTIVETRANSFORM_H_
-#define XFA_FXBARCODE_COMMON_BC_COMMONPERSPECTIVETRANSFORM_H_
-
-#include "core/fxcrt/include/fx_basic.h"
-
-class CBC_CommonPerspectiveTransform {
- public:
- CBC_CommonPerspectiveTransform(FX_FLOAT a11,
- FX_FLOAT a21,
- FX_FLOAT a31,
- FX_FLOAT a12,
- FX_FLOAT a22,
- FX_FLOAT a32,
- FX_FLOAT a13,
- FX_FLOAT a23,
- FX_FLOAT a33);
- virtual ~CBC_CommonPerspectiveTransform();
-
- static CBC_CommonPerspectiveTransform* QuadrilateralToQuadrilateral(
- FX_FLOAT x0,
- FX_FLOAT y0,
- FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- FX_FLOAT x3,
- FX_FLOAT y3,
- FX_FLOAT x0p,
- FX_FLOAT y0p,
- FX_FLOAT x1p,
- FX_FLOAT y1p,
- FX_FLOAT x2p,
- FX_FLOAT y2p,
- FX_FLOAT x3p,
- FX_FLOAT y3p);
- static CBC_CommonPerspectiveTransform* SquareToQuadrilateral(FX_FLOAT x0,
- FX_FLOAT y0,
- FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- FX_FLOAT x3,
- FX_FLOAT y3);
- static CBC_CommonPerspectiveTransform* QuadrilateralToSquare(FX_FLOAT x0,
- FX_FLOAT y0,
- FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- FX_FLOAT x3,
- FX_FLOAT y3);
- CBC_CommonPerspectiveTransform* BuildAdjoint();
- CBC_CommonPerspectiveTransform* Times(CBC_CommonPerspectiveTransform& other);
- void TransformPoints(CFX_FloatArray* points);
-
- private:
- FX_FLOAT m_a11, m_a12, m_a13, m_a21, m_a22, m_a23, m_a31, m_a32, m_a33;
-};
-
-#endif // XFA_FXBARCODE_COMMON_BC_COMMONPERSPECTIVETRANSFORM_H_
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Codeword.cpp b/xfa/fxbarcode/pdf417/BC_PDF417Codeword.cpp
deleted file mode 100644
index 0280ea0953..0000000000
--- a/xfa/fxbarcode/pdf417/BC_PDF417Codeword.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// 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
-// Original code is licensed as follows:
-/*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/pdf417/BC_PDF417Codeword.h"
-
-int32_t CBC_Codeword::BARCODE_ROW_UNKNOWN = -1;
-CBC_Codeword::CBC_Codeword(int32_t startX,
- int32_t endX,
- int32_t bucket,
- int32_t cvalue) {
- m_startX = startX;
- m_endX = endX;
- m_bucket = bucket;
- m_value = cvalue;
- m_rowNumber = BARCODE_ROW_UNKNOWN;
-}
-CBC_Codeword::~CBC_Codeword() {}
-FX_BOOL CBC_Codeword::hasValidRowNumber() {
- return isValidRowNumber(m_rowNumber);
-}
-FX_BOOL CBC_Codeword::isValidRowNumber(int32_t rowNumber) {
- return m_rowNumber != BARCODE_ROW_UNKNOWN &&
- m_bucket == (m_rowNumber % 3) * 3;
-}
-void CBC_Codeword::setRowNumberAsRowIndicatorColumn() {
- m_rowNumber = (m_value / 30) * 3 + m_bucket / 3;
-}
-int32_t CBC_Codeword::getWidth() {
- return m_endX - m_startX;
-}
-int32_t CBC_Codeword::getStartX() {
- return m_startX;
-}
-int32_t CBC_Codeword::getEndX() {
- return m_endX;
-}
-int32_t CBC_Codeword::getBucket() {
- return m_bucket;
-}
-int32_t CBC_Codeword::getValue() {
- return m_value;
-}
-int32_t CBC_Codeword::getRowNumber() {
- return m_rowNumber;
-}
-void CBC_Codeword::setRowNumber(int32_t rowNumber) {
- m_rowNumber = rowNumber;
-}
-CFX_ByteString CBC_Codeword::toString() {
- return m_rowNumber + (FX_CHAR)'|' + m_value;
-}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Codeword.h b/xfa/fxbarcode/pdf417/BC_PDF417Codeword.h
deleted file mode 100644
index 2423cab757..0000000000
--- a/xfa/fxbarcode/pdf417/BC_PDF417Codeword.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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 XFA_FXBARCODE_PDF417_BC_PDF417CODEWORD_H_
-#define XFA_FXBARCODE_PDF417_BC_PDF417CODEWORD_H_
-
-#include "core/fxcrt/include/fx_basic.h"
-
-class CBC_Codeword {
- public:
- CBC_Codeword(int32_t startX, int32_t endX, int32_t bucket, int32_t value);
- virtual ~CBC_Codeword();
-
- FX_BOOL hasValidRowNumber();
- FX_BOOL isValidRowNumber(int32_t rowNumber);
- void setRowNumberAsRowIndicatorColumn();
- int32_t getWidth();
- int32_t getStartX();
- int32_t getEndX();
- int32_t getBucket();
- int32_t getValue();
- int32_t getRowNumber();
- void setRowNumber(int32_t rowNumber);
- CFX_ByteString toString();
-
- private:
- static int32_t BARCODE_ROW_UNKNOWN;
- int32_t m_startX;
- int32_t m_endX;
- int32_t m_bucket;
- int32_t m_value;
- int32_t m_rowNumber;
-};
-
-#endif // XFA_FXBARCODE_PDF417_BC_PDF417CODEWORD_H_