summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/qrcode
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxbarcode/qrcode')
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRAlignmentPattern.h10
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCodeReader.h11
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCodeWriter.h8
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRDataMask.cpp78
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRFinderPattern.h8
5 files changed, 86 insertions, 29 deletions
diff --git a/xfa/fxbarcode/qrcode/BC_QRAlignmentPattern.h b/xfa/fxbarcode/qrcode/BC_QRAlignmentPattern.h
index 9a4e80c2b2..7006b72c9c 100644
--- a/xfa/fxbarcode/qrcode/BC_QRAlignmentPattern.h
+++ b/xfa/fxbarcode/qrcode/BC_QRAlignmentPattern.h
@@ -15,10 +15,14 @@ class CBC_QRAlignmentPattern : public CBC_ResultPoint {
CBC_QRAlignmentPattern(FX_FLOAT posX,
FX_FLOAT posY,
FX_FLOAT estimateModuleSize);
- virtual ~CBC_QRAlignmentPattern();
+ ~CBC_QRAlignmentPattern() override;
+
+ // CBC_ResultPoint
+ FX_FLOAT GetX() override;
+ FX_FLOAT GetY() override;
+
FX_BOOL AboutEquals(FX_FLOAT moduleSize, FX_FLOAT i, FX_FLOAT j);
- FX_FLOAT GetX();
- FX_FLOAT GetY();
+
CBC_QRAlignmentPattern* Clone();
};
diff --git a/xfa/fxbarcode/qrcode/BC_QRCodeReader.h b/xfa/fxbarcode/qrcode/BC_QRCodeReader.h
index c11ccd1f26..b3a72b4d18 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCodeReader.h
+++ b/xfa/fxbarcode/qrcode/BC_QRCodeReader.h
@@ -22,7 +22,8 @@ class CBC_QRCodeReader : public CBC_Reader {
public:
CBC_QRCodeReader();
- virtual ~CBC_QRCodeReader();
+ ~CBC_QRCodeReader() override;
+
CFX_ByteString Decode(CFX_DIBitmap* pBitmap,
int32_t hints,
int32_t byteModeDecode,
@@ -32,8 +33,12 @@ class CBC_QRCodeReader : public CBC_Reader {
int32_t byteModeDecode,
int32_t& e);
static void ReleaseAll();
- CFX_ByteString Decode(CBC_BinaryBitmap* image, int32_t hints, int32_t& e);
- CFX_ByteString Decode(CBC_BinaryBitmap* image, int32_t& e);
+
+ // CBC_Reader
+ CFX_ByteString Decode(CBC_BinaryBitmap* image,
+ int32_t hints,
+ int32_t& e) override;
+ CFX_ByteString Decode(CBC_BinaryBitmap* image, int32_t& e) override;
virtual void Init();
};
diff --git a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.h b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.h
index c68c6c0a3f..6562107f10 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.h
+++ b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.h
@@ -13,7 +13,8 @@ class CBC_TwoDimWriter;
class CBC_QRCodeWriter : public CBC_TwoDimWriter {
public:
CBC_QRCodeWriter();
- virtual ~CBC_QRCodeWriter();
+ ~CBC_QRCodeWriter() override;
+
uint8_t* Encode(const CFX_WideString& contents,
int32_t ecLevel,
int32_t& outWidth,
@@ -31,7 +32,10 @@ class CBC_QRCodeWriter : public CBC_TwoDimWriter {
int32_t& outHeight,
int32_t& e);
FX_BOOL SetVersion(int32_t version);
- FX_BOOL SetErrorCorrectionLevel(int32_t level);
+
+ // CBC_TwoDimWriter
+ FX_BOOL SetErrorCorrectionLevel(int32_t level) override;
+
static void ReleaseAll();
private:
diff --git a/xfa/fxbarcode/qrcode/BC_QRDataMask.cpp b/xfa/fxbarcode/qrcode/BC_QRDataMask.cpp
index 9b5e3ca014..e21b5d2d37 100644
--- a/xfa/fxbarcode/qrcode/BC_QRDataMask.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRDataMask.cpp
@@ -67,46 +67,52 @@ CBC_QRDataMask* CBC_QRDataMask::ForReference(int32_t reference, int32_t& e) {
class DataMask000 : public CBC_QRDataMask {
public:
- FX_BOOL IsMasked(int32_t x, int32_t y) { return ((x + y) % 2) == 0; }
+ // CBC_QRDataMask
+ FX_BOOL IsMasked(int32_t x, int32_t y) override;
};
+
class DataMask001 : public CBC_QRDataMask {
public:
- FX_BOOL IsMasked(int32_t x, int32_t y) { return (x % 2) == 0; }
+ // CBC_QRDataMask
+ FX_BOOL IsMasked(int32_t x, int32_t y) override;
};
+
class DataMask010 : public CBC_QRDataMask {
public:
- FX_BOOL IsMasked(int32_t x, int32_t y) { return y % 3 == 0; }
+ // CBC_QRDataMask
+ FX_BOOL IsMasked(int32_t x, int32_t y) override;
};
+
class DataMask011 : public CBC_QRDataMask {
public:
- FX_BOOL IsMasked(int32_t x, int32_t y) { return (x + y) % 3 == 0; }
+ // CBC_QRDataMask
+ FX_BOOL IsMasked(int32_t x, int32_t y) override;
};
+
class DataMask100 : public CBC_QRDataMask {
public:
- FX_BOOL IsMasked(int32_t x, int32_t y) {
- return (((x >> 1) + (y / 3)) % 2) == 0;
- }
+ // CBC_QRDataMask
+ FX_BOOL IsMasked(int32_t x, int32_t y) override;
};
+
class DataMask101 : public CBC_QRDataMask {
public:
- FX_BOOL IsMasked(int32_t x, int32_t y) {
- size_t temp = x * y;
- return (temp % 2) + (temp % 3) == 0;
- }
+ // CBC_QRDataMask
+ FX_BOOL IsMasked(int32_t x, int32_t y) override;
};
+
class DataMask110 : public CBC_QRDataMask {
public:
- FX_BOOL IsMasked(int32_t x, int32_t y) {
- size_t temp = x * y;
- return (((temp % 2) + (temp % 3)) % 2) == 0;
- }
+ // CBC_QRDataMask
+ FX_BOOL IsMasked(int32_t x, int32_t y) override;
};
+
class DataMask111 : public CBC_QRDataMask {
public:
- FX_BOOL IsMasked(int32_t x, int32_t y) {
- return ((((x + y) % 2) + ((x * y) % 3)) % 2) == 0;
- }
+ // CBC_QRDataMask
+ FX_BOOL IsMasked(int32_t x, int32_t y) override;
};
+
int32_t CBC_QRDataMask::BuildDataMasks() {
DATA_MASKS->Add(new DataMask000);
DATA_MASKS->Add(new DataMask001);
@@ -118,5 +124,41 @@ int32_t CBC_QRDataMask::BuildDataMasks() {
DATA_MASKS->Add(new DataMask111);
return DATA_MASKS->GetSize();
}
+
CBC_QRDataMask::CBC_QRDataMask() {}
+
CBC_QRDataMask::~CBC_QRDataMask() {}
+
+FX_BOOL DataMask000::IsMasked(int32_t x, int32_t y) {
+ return ((x + y) % 2) == 0;
+}
+
+FX_BOOL DataMask001::IsMasked(int32_t x, int32_t y) {
+ return (x % 2) == 0;
+}
+
+FX_BOOL DataMask010::IsMasked(int32_t x, int32_t y) {
+ return y % 3 == 0;
+}
+
+FX_BOOL DataMask011::IsMasked(int32_t x, int32_t y) {
+ return (x + y) % 3 == 0;
+}
+
+FX_BOOL DataMask100::IsMasked(int32_t x, int32_t y) {
+ return (((x >> 1) + (y / 3)) % 2) == 0;
+}
+
+FX_BOOL DataMask101::IsMasked(int32_t x, int32_t y) {
+ size_t temp = x * y;
+ return (temp % 2) + (temp % 3) == 0;
+}
+
+FX_BOOL DataMask110::IsMasked(int32_t x, int32_t y) {
+ size_t temp = x * y;
+ return (((temp % 2) + (temp % 3)) % 2) == 0;
+}
+
+FX_BOOL DataMask111::IsMasked(int32_t x, int32_t y) {
+ return ((((x + y) % 2) + ((x * y) % 3)) % 2) == 0;
+}
diff --git a/xfa/fxbarcode/qrcode/BC_QRFinderPattern.h b/xfa/fxbarcode/qrcode/BC_QRFinderPattern.h
index 0dc2f3cfcb..f02a229121 100644
--- a/xfa/fxbarcode/qrcode/BC_QRFinderPattern.h
+++ b/xfa/fxbarcode/qrcode/BC_QRFinderPattern.h
@@ -16,11 +16,13 @@ class CBC_QRFinderPattern : public CBC_ResultPoint {
public:
CBC_QRFinderPattern(FX_FLOAT x, FX_FLOAT posY, FX_FLOAT estimatedModuleSize);
- virtual ~CBC_QRFinderPattern();
+ ~CBC_QRFinderPattern() override;
+
+ // CBC_ResultPoint
+ FX_FLOAT GetX() override;
+ FX_FLOAT GetY() override;
int32_t GetCount() const;
- FX_FLOAT GetX();
- FX_FLOAT GetY();
FX_FLOAT GetEstimatedModuleSize();
void IncrementCount();
FX_BOOL AboutEquals(FX_FLOAT moduleSize, FX_FLOAT i, FX_FLOAT j);