summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-28 15:16:51 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-28 15:16:51 -0700
commit33a747db5c9ce18bdfaaaaea17b03ef26d14ff54 (patch)
tree9d8249844ea44f432891ffa67d7bca51bdb1f033
parent18713d20e080c344e0ed09e3f0ac5bacb0645fc5 (diff)
downloadpdfium-33a747db5c9ce18bdfaaaaea17b03ef26d14ff54.tar.xz
Replace CFX_PtrArray with typesafe CFX_ArrayTemplate, Part 5
Remove unused m_pdf417byteSegments, which was coped into from an empty array and never again referenced. Review-Url: https://codereview.chromium.org/1927253002
-rw-r--r--xfa/fxbarcode/common/BC_CommonDecoderResult.cpp2
-rw-r--r--xfa/fxbarcode/common/BC_CommonDecoderResult.h2
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp3
-rw-r--r--xfa/fxbarcode/qrcode/BC_FinderPatternInfo.cpp19
-rw-r--r--xfa/fxbarcode/qrcode/BC_FinderPatternInfo.h16
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp13
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h20
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRFinderPattern.cpp2
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRFinderPattern.h2
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp93
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.h28
11 files changed, 104 insertions, 96 deletions
diff --git a/xfa/fxbarcode/common/BC_CommonDecoderResult.cpp b/xfa/fxbarcode/common/BC_CommonDecoderResult.cpp
index d28a88bfbc..45aff1cae1 100644
--- a/xfa/fxbarcode/common/BC_CommonDecoderResult.cpp
+++ b/xfa/fxbarcode/common/BC_CommonDecoderResult.cpp
@@ -44,7 +44,6 @@ void CBC_CommonDecoderResult::Init(const CFX_ByteArray& rawBytes,
}
void CBC_CommonDecoderResult::Init(const CFX_ByteArray& rawBytes,
const CFX_ByteString& text,
- const CFX_PtrArray& byteSegments,
const CFX_ByteString& ecLevel,
int32_t& e) {
if (text.IsEmpty()) {
@@ -53,7 +52,6 @@ void CBC_CommonDecoderResult::Init(const CFX_ByteArray& rawBytes,
}
m_rawBytes.Copy(rawBytes);
m_text = text;
- m_pdf417byteSegments.Copy(byteSegments);
m_pdf417ecLevel = ecLevel;
m_other = NULL;
}
diff --git a/xfa/fxbarcode/common/BC_CommonDecoderResult.h b/xfa/fxbarcode/common/BC_CommonDecoderResult.h
index 9dc4b66dce..cec7431119 100644
--- a/xfa/fxbarcode/common/BC_CommonDecoderResult.h
+++ b/xfa/fxbarcode/common/BC_CommonDecoderResult.h
@@ -27,7 +27,6 @@ class CBC_CommonDecoderResult {
int32_t& e);
virtual void Init(const CFX_ByteArray& rawBytes,
const CFX_ByteString& text,
- const CFX_PtrArray& byteSegments,
const CFX_ByteString& ecLevel,
int32_t& e);
void setOther(CBC_PDF417ResultMetadata* other);
@@ -36,7 +35,6 @@ class CBC_CommonDecoderResult {
CFX_ByteArray m_rawBytes;
CFX_ByteString m_text;
CFX_Int32Array m_byteSegments;
- CFX_PtrArray m_pdf417byteSegments;
CBC_QRCoderErrorCorrectionLevel* m_ecLevel;
CFX_ByteString m_pdf417ecLevel;
CBC_PDF417ResultMetadata* m_other;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp b/xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp
index 04246bd5d8..92351d0c61 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp
@@ -113,9 +113,8 @@ CBC_CommonDecoderResult* CBC_DecodedBitStreamPaser::decode(
return NULL;
}
CFX_ByteArray rawBytes;
- CFX_PtrArray byteSegments;
CBC_CommonDecoderResult* tempCd = new CBC_CommonDecoderResult();
- tempCd->Init(rawBytes, result, byteSegments, ecLevel, e);
+ tempCd->Init(rawBytes, result, ecLevel, e);
if (e != BCExceptionNO) {
delete resultMetadata;
return NULL;
diff --git a/xfa/fxbarcode/qrcode/BC_FinderPatternInfo.cpp b/xfa/fxbarcode/qrcode/BC_FinderPatternInfo.cpp
index 25dc28b3f3..63b3ab790d 100644
--- a/xfa/fxbarcode/qrcode/BC_FinderPatternInfo.cpp
+++ b/xfa/fxbarcode/qrcode/BC_FinderPatternInfo.cpp
@@ -24,18 +24,23 @@
#include "xfa/fxbarcode/qrcode/BC_FinderPatternInfo.h"
#include "xfa/fxbarcode/qrcode/BC_QRFinderPattern.h"
-CBC_QRFinderPatternInfo::CBC_QRFinderPatternInfo(CFX_PtrArray* patternCenters) {
- m_bottomLeft = (CBC_QRFinderPattern*)(*patternCenters)[0];
- m_topLeft = (CBC_QRFinderPattern*)(*patternCenters)[1];
- m_topRight = (CBC_QRFinderPattern*)(*patternCenters)[2];
+CBC_QRFinderPatternInfo::CBC_QRFinderPatternInfo(
+ CFX_ArrayTemplate<CBC_QRFinderPattern*>* patternCenters) {
+ m_bottomLeft = (*patternCenters)[0];
+ m_topLeft = (*patternCenters)[1];
+ m_topRight = (*patternCenters)[2];
}
+
CBC_QRFinderPatternInfo::~CBC_QRFinderPatternInfo() {}
-CBC_QRFinderPattern* CBC_QRFinderPatternInfo::GetBottomLeft() {
+
+CBC_QRFinderPattern* CBC_QRFinderPatternInfo::GetBottomLeft() const {
return m_bottomLeft;
}
-CBC_QRFinderPattern* CBC_QRFinderPatternInfo::GetTopLeft() {
+
+CBC_QRFinderPattern* CBC_QRFinderPatternInfo::GetTopLeft() const {
return m_topLeft;
}
-CBC_QRFinderPattern* CBC_QRFinderPatternInfo::GetTopRight() {
+
+CBC_QRFinderPattern* CBC_QRFinderPatternInfo::GetTopRight() const {
return m_topRight;
}
diff --git a/xfa/fxbarcode/qrcode/BC_FinderPatternInfo.h b/xfa/fxbarcode/qrcode/BC_FinderPatternInfo.h
index 1091d6723d..6d0cb60f2f 100644
--- a/xfa/fxbarcode/qrcode/BC_FinderPatternInfo.h
+++ b/xfa/fxbarcode/qrcode/BC_FinderPatternInfo.h
@@ -12,17 +12,19 @@
class CBC_QRFinderPattern;
class CBC_QRFinderPatternInfo {
+ public:
+ explicit CBC_QRFinderPatternInfo(
+ CFX_ArrayTemplate<CBC_QRFinderPattern*>* patternCenters);
+ ~CBC_QRFinderPatternInfo();
+
+ CBC_QRFinderPattern* GetBottomLeft() const;
+ CBC_QRFinderPattern* GetTopLeft() const;
+ CBC_QRFinderPattern* GetTopRight() const;
+
private:
CBC_QRFinderPattern* m_bottomLeft;
CBC_QRFinderPattern* m_topLeft;
CBC_QRFinderPattern* m_topRight;
-
- public:
- CBC_QRFinderPatternInfo(CFX_PtrArray* patternCenters);
- virtual ~CBC_QRFinderPatternInfo();
- CBC_QRFinderPattern* GetBottomLeft();
- CBC_QRFinderPattern* GetTopLeft();
- CBC_QRFinderPattern* GetTopRight();
};
#endif // XFA_FXBARCODE_QRCODE_BC_FINDERPATTERNINFO_H_
diff --git a/xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp b/xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp
index 8c462bf328..75565ca641 100644
--- a/xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp
@@ -40,12 +40,12 @@ CBC_QRAlignmentPatternFinder::CBC_QRAlignmentPatternFinder(
m_moduleSize(moduleSize) {
m_crossCheckStateCount.SetSize(3);
}
+
CBC_QRAlignmentPatternFinder::~CBC_QRAlignmentPatternFinder() {
- for (int32_t i = 0; i < m_possibleCenters.GetSize(); i++) {
- delete (CBC_QRAlignmentPattern*)m_possibleCenters[i];
- }
- m_possibleCenters.RemoveAll();
+ for (int32_t i = 0; i < m_possibleCenters.GetSize(); i++)
+ delete m_possibleCenters[i];
}
+
CBC_QRAlignmentPattern* CBC_QRAlignmentPatternFinder::Find(int32_t& e) {
int32_t startX = m_startX;
int32_t height = m_height;
@@ -102,7 +102,7 @@ CBC_QRAlignmentPattern* CBC_QRAlignmentPatternFinder::Find(int32_t& e) {
}
}
if (m_possibleCenters.GetSize() != 0) {
- return ((CBC_QRAlignmentPattern*)(m_possibleCenters[0]))->Clone();
+ return m_possibleCenters[0]->Clone();
}
e = BCExceptionRead;
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
@@ -186,8 +186,7 @@ CBC_QRAlignmentPattern* CBC_QRAlignmentPatternFinder::HandlePossibleCenter(
(FX_FLOAT)(stateCount[0] + stateCount[1] + stateCount[2]) / 3.0f;
int32_t max = m_possibleCenters.GetSize();
for (int32_t index = 0; index < max; index++) {
- CBC_QRAlignmentPattern* center =
- (CBC_QRAlignmentPattern*)(m_possibleCenters[index]);
+ CBC_QRAlignmentPattern* center = m_possibleCenters[index];
if (center->AboutEquals(estimatedModuleSize, centerI, centerJ)) {
return new CBC_QRAlignmentPattern(centerJ, centerI,
estimatedModuleSize);
diff --git a/xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h b/xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h
index d227708fd8..e524c4bdaf 100644
--- a/xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h
+++ b/xfa/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h
@@ -14,16 +14,6 @@ class CBC_CommonBitMatrix;
class CBC_QRAlignmentPattern;
class CBC_QRAlignmentPatternFinder {
- private:
- CBC_CommonBitMatrix* m_image;
- CFX_PtrArray m_possibleCenters;
- int32_t m_startX;
- int32_t m_startY;
- int32_t m_width;
- int32_t m_height;
- FX_FLOAT m_moduleSize;
- CFX_Int32Array m_crossCheckStateCount;
-
public:
CBC_QRAlignmentPatternFinder(CBC_CommonBitMatrix* image,
int32_t startX,
@@ -42,6 +32,16 @@ class CBC_QRAlignmentPatternFinder {
int32_t i,
int32_t j);
static FX_FLOAT CenterFromEnd(const CFX_Int32Array& stateCount, int32_t end);
+
+ private:
+ CBC_CommonBitMatrix* m_image;
+ CFX_ArrayTemplate<CBC_QRAlignmentPattern*> m_possibleCenters;
+ int32_t m_startX;
+ int32_t m_startY;
+ int32_t m_width;
+ int32_t m_height;
+ FX_FLOAT m_moduleSize;
+ CFX_Int32Array m_crossCheckStateCount;
};
#endif // XFA_FXBARCODE_QRCODE_BC_QRALIGNMENTPATTERNFINDER_H_
diff --git a/xfa/fxbarcode/qrcode/BC_QRFinderPattern.cpp b/xfa/fxbarcode/qrcode/BC_QRFinderPattern.cpp
index 5039920e32..1bc9648835 100644
--- a/xfa/fxbarcode/qrcode/BC_QRFinderPattern.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRFinderPattern.cpp
@@ -44,7 +44,7 @@ CBC_QRFinderPattern* CBC_QRFinderPattern::Clone() {
FX_FLOAT CBC_QRFinderPattern::GetEstimatedModuleSize() {
return m_estimatedModuleSize;
}
-int32_t CBC_QRFinderPattern::GetCount() {
+int32_t CBC_QRFinderPattern::GetCount() const {
return m_count;
}
void CBC_QRFinderPattern::IncrementCount() {
diff --git a/xfa/fxbarcode/qrcode/BC_QRFinderPattern.h b/xfa/fxbarcode/qrcode/BC_QRFinderPattern.h
index bf3adffea4..0dc2f3cfcb 100644
--- a/xfa/fxbarcode/qrcode/BC_QRFinderPattern.h
+++ b/xfa/fxbarcode/qrcode/BC_QRFinderPattern.h
@@ -18,7 +18,7 @@ class CBC_QRFinderPattern : public CBC_ResultPoint {
CBC_QRFinderPattern(FX_FLOAT x, FX_FLOAT posY, FX_FLOAT estimatedModuleSize);
virtual ~CBC_QRFinderPattern();
- int32_t GetCount();
+ int32_t GetCount() const;
FX_FLOAT GetX();
FX_FLOAT GetY();
FX_FLOAT GetEstimatedModuleSize();
diff --git a/xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp b/xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp
index ea08f1550d..dc63131d01 100644
--- a/xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp
@@ -42,12 +42,12 @@ CBC_QRFinderPatternFinder::CBC_QRFinderPatternFinder(
m_crossCheckStateCount.SetSize(5);
m_hasSkipped = FALSE;
}
+
CBC_QRFinderPatternFinder::~CBC_QRFinderPatternFinder() {
- for (int32_t i = 0; i < m_possibleCenters.GetSize(); i++) {
- delete (CBC_QRFinderPattern*)m_possibleCenters[i];
- }
- m_possibleCenters.RemoveAll();
+ for (int32_t i = 0; i < m_possibleCenters.GetSize(); i++)
+ delete m_possibleCenters[i];
}
+
class ClosestToAverageComparator {
private:
FX_FLOAT m_averageModuleSize;
@@ -80,9 +80,12 @@ CFX_Int32Array& CBC_QRFinderPatternFinder::GetCrossCheckStateCount() {
m_crossCheckStateCount[4] = 0;
return m_crossCheckStateCount;
}
-CFX_PtrArray* CBC_QRFinderPatternFinder::GetPossibleCenters() {
+
+CFX_ArrayTemplate<CBC_QRFinderPattern*>*
+CBC_QRFinderPatternFinder::GetPossibleCenters() {
return &m_possibleCenters;
}
+
CBC_QRFinderPatternInfo* CBC_QRFinderPatternFinder::Find(int32_t hint,
int32_t& e) {
int32_t maxI = m_image->GetHeight();
@@ -161,31 +164,32 @@ CBC_QRFinderPatternInfo* CBC_QRFinderPatternFinder::Find(int32_t hint,
}
}
}
- std::unique_ptr<CFX_PtrArray> patternInfo(SelectBestpatterns(e));
+ std::unique_ptr<CFX_ArrayTemplate<CBC_QRFinderPattern*>> patternInfo(
+ SelectBestpatterns(e));
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
OrderBestPatterns(patternInfo.get());
return new CBC_QRFinderPatternInfo(patternInfo.get());
}
-void CBC_QRFinderPatternFinder::OrderBestPatterns(CFX_PtrArray* patterns) {
- FX_FLOAT abDistance = Distance((CBC_ResultPoint*)(*patterns)[0],
- (CBC_ResultPoint*)(*patterns)[1]);
- FX_FLOAT bcDistance = Distance((CBC_ResultPoint*)(*patterns)[1],
- (CBC_ResultPoint*)(*patterns)[2]);
- FX_FLOAT acDistance = Distance((CBC_ResultPoint*)(*patterns)[0],
- (CBC_ResultPoint*)(*patterns)[2]);
- CBC_QRFinderPattern *topLeft, *topRight, *bottomLeft;
+void CBC_QRFinderPatternFinder::OrderBestPatterns(
+ CFX_ArrayTemplate<CBC_QRFinderPattern*>* patterns) {
+ FX_FLOAT abDistance = Distance((*patterns)[0], (*patterns)[1]);
+ FX_FLOAT bcDistance = Distance((*patterns)[1], (*patterns)[2]);
+ FX_FLOAT acDistance = Distance((*patterns)[0], (*patterns)[2]);
+ CBC_QRFinderPattern* topLeft;
+ CBC_QRFinderPattern* topRight;
+ CBC_QRFinderPattern* bottomLeft;
if (bcDistance >= abDistance && bcDistance >= acDistance) {
- topLeft = (CBC_QRFinderPattern*)(*patterns)[0];
- topRight = (CBC_QRFinderPattern*)(*patterns)[1];
- bottomLeft = (CBC_QRFinderPattern*)(*patterns)[2];
+ topLeft = (*patterns)[0];
+ topRight = (*patterns)[1];
+ bottomLeft = (*patterns)[2];
} else if (acDistance >= bcDistance && acDistance >= abDistance) {
- topLeft = (CBC_QRFinderPattern*)(*patterns)[1];
- topRight = (CBC_QRFinderPattern*)(*patterns)[0];
- bottomLeft = (CBC_QRFinderPattern*)(*patterns)[2];
+ topLeft = (*patterns)[1];
+ topRight = (*patterns)[0];
+ bottomLeft = (*patterns)[2];
} else {
- topLeft = (CBC_QRFinderPattern*)(*patterns)[2];
- topRight = (CBC_QRFinderPattern*)(*patterns)[0];
- bottomLeft = (CBC_QRFinderPattern*)(*patterns)[1];
+ topLeft = (*patterns)[2];
+ topRight = (*patterns)[0];
+ bottomLeft = (*patterns)[1];
}
if ((bottomLeft->GetY() - topLeft->GetY()) *
(topRight->GetX() - topLeft->GetX()) <
@@ -375,8 +379,7 @@ FX_BOOL CBC_QRFinderPatternFinder::HandlePossibleCenter(
FX_BOOL found = FALSE;
int32_t max = m_possibleCenters.GetSize();
for (int32_t index = 0; index < max; index++) {
- CBC_QRFinderPattern* center =
- (CBC_QRFinderPattern*)(m_possibleCenters[index]);
+ CBC_QRFinderPattern* center = m_possibleCenters[index];
if (center->AboutEquals(estimatedModuleSize, centerI, centerJ)) {
center->IncrementCount();
found = TRUE;
@@ -399,7 +402,7 @@ int32_t CBC_QRFinderPatternFinder::FindRowSkip() {
}
FinderPattern* firstConfirmedCenter = NULL;
for (int32_t i = 0; i < max; i++) {
- CBC_QRFinderPattern* center = (CBC_QRFinderPattern*)m_possibleCenters[i];
+ CBC_QRFinderPattern* center = m_possibleCenters[i];
if (center->GetCount() >= CENTER_QUORUM) {
if (firstConfirmedCenter == NULL) {
firstConfirmedCenter = center;
@@ -419,7 +422,7 @@ FX_BOOL CBC_QRFinderPatternFinder::HaveMultiplyConfirmedCenters() {
int32_t max = m_possibleCenters.GetSize();
int32_t i;
for (i = 0; i < max; i++) {
- CBC_QRFinderPattern* pattern = (CBC_QRFinderPattern*)m_possibleCenters[i];
+ CBC_QRFinderPattern* pattern = m_possibleCenters[i];
if (pattern->GetCount() >= CENTER_QUORUM) {
confirmedCount++;
totalModuleSize += pattern->GetEstimatedModuleSize();
@@ -431,16 +434,14 @@ FX_BOOL CBC_QRFinderPatternFinder::HaveMultiplyConfirmedCenters() {
FX_FLOAT average = totalModuleSize / (FX_FLOAT)max;
FX_FLOAT totalDeviation = 0.0f;
for (i = 0; i < max; i++) {
- CBC_QRFinderPattern* pattern = (CBC_QRFinderPattern*)m_possibleCenters[i];
+ CBC_QRFinderPattern* pattern = m_possibleCenters[i];
totalDeviation += fabs(pattern->GetEstimatedModuleSize() - average);
}
return totalDeviation <= 0.05f * totalModuleSize;
}
-inline FX_BOOL centerComparator(void* a, void* b) {
- return ((CBC_QRFinderPattern*)b)->GetCount() <
- ((CBC_QRFinderPattern*)a)->GetCount();
-}
-CFX_PtrArray* CBC_QRFinderPatternFinder::SelectBestpatterns(int32_t& e) {
+
+CFX_ArrayTemplate<CBC_QRFinderPattern*>*
+CBC_QRFinderPatternFinder::SelectBestpatterns(int32_t& e) {
int32_t startSize = m_possibleCenters.GetSize();
if (m_possibleCenters.GetSize() < 3) {
e = BCExceptionRead;
@@ -449,15 +450,14 @@ CFX_PtrArray* CBC_QRFinderPatternFinder::SelectBestpatterns(int32_t& e) {
FX_FLOAT average = 0.0f;
if (startSize > 3) {
FX_FLOAT totalModuleSize = 0.0f;
- for (int32_t i = 0; i < startSize; i++) {
- totalModuleSize += ((CBC_QRFinderPattern*)m_possibleCenters[i])
- ->GetEstimatedModuleSize();
- }
+ for (int32_t i = 0; i < startSize; i++)
+ totalModuleSize += m_possibleCenters[i]->GetEstimatedModuleSize();
+
average = totalModuleSize / (FX_FLOAT)startSize;
for (int32_t j = 0;
j < m_possibleCenters.GetSize() && m_possibleCenters.GetSize() > 3;
j++) {
- CBC_QRFinderPattern* pattern = (CBC_QRFinderPattern*)m_possibleCenters[j];
+ CBC_QRFinderPattern* pattern = m_possibleCenters[j];
if (fabs(pattern->GetEstimatedModuleSize() - average) > 0.2f * average) {
delete pattern;
m_possibleCenters.RemoveAt(j);
@@ -466,12 +466,17 @@ CFX_PtrArray* CBC_QRFinderPatternFinder::SelectBestpatterns(int32_t& e) {
}
}
if (m_possibleCenters.GetSize() > 3) {
- BC_FX_PtrArray_Sort(m_possibleCenters, centerComparator);
- }
- CFX_PtrArray* vec = new CFX_PtrArray();
+ std::sort(m_possibleCenters.GetData(),
+ m_possibleCenters.GetData() + m_possibleCenters.GetSize(),
+ [](const CBC_QRFinderPattern* a, CBC_QRFinderPattern* b) {
+ return a->GetCount() > b->GetCount(); // e.g. Descending.
+ });
+ }
+ CFX_ArrayTemplate<CBC_QRFinderPattern*>* vec =
+ new CFX_ArrayTemplate<CBC_QRFinderPattern*>();
vec->SetSize(3);
- (*vec)[0] = ((CBC_QRFinderPattern*)m_possibleCenters[0])->Clone();
- (*vec)[1] = ((CBC_QRFinderPattern*)m_possibleCenters[1])->Clone();
- (*vec)[2] = ((CBC_QRFinderPattern*)m_possibleCenters[2])->Clone();
+ (*vec)[0] = m_possibleCenters[0]->Clone();
+ (*vec)[1] = m_possibleCenters[1]->Clone();
+ (*vec)[2] = m_possibleCenters[2]->Clone();
return vec;
}
diff --git a/xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.h b/xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.h
index ada224787b..60ec184fe4 100644
--- a/xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.h
+++ b/xfa/fxbarcode/qrcode/BC_QRFinderPatternFinder.h
@@ -15,16 +15,6 @@ class CBC_ResultPoint;
class CBC_QRFinderPatternInfo;
class CBC_QRFinderPatternFinder {
- private:
- static const int32_t CENTER_QUORUM;
- static const int32_t MIN_SKIP;
- static const int32_t MAX_MODULES;
- static const int32_t INTEGER_MATH_SHIFT;
- FX_BOOL m_hasSkipped;
- CBC_CommonBitMatrix* m_image;
- CFX_Int32Array m_crossCheckStateCount;
- CFX_PtrArray m_possibleCenters;
-
public:
CBC_QRFinderPatternFinder(CBC_CommonBitMatrix* image);
virtual ~CBC_QRFinderPatternFinder();
@@ -33,8 +23,8 @@ class CBC_QRFinderPatternFinder {
CBC_QRFinderPatternInfo* Find(int32_t hint, int32_t& e);
CFX_Int32Array& GetCrossCheckStateCount();
- CFX_PtrArray* GetPossibleCenters();
- CFX_PtrArray* SelectBestpatterns(int32_t& e);
+ CFX_ArrayTemplate<CBC_QRFinderPattern*>* GetPossibleCenters();
+ CFX_ArrayTemplate<CBC_QRFinderPattern*>* SelectBestpatterns(int32_t& e);
FX_BOOL HandlePossibleCenter(const CFX_Int32Array& stateCount,
int32_t i,
@@ -49,9 +39,21 @@ class CBC_QRFinderPatternFinder {
int32_t CenterI,
int32_t maxCOunt,
int32_t originalStateCountTotal);
- static void OrderBestPatterns(CFX_PtrArray* patterns);
+ static void OrderBestPatterns(
+ CFX_ArrayTemplate<CBC_QRFinderPattern*>* patterns);
static FX_BOOL FoundPatternCross(const CFX_Int32Array& stateCount);
static FX_FLOAT Distance(CBC_ResultPoint* point1, CBC_ResultPoint* point2);
+
+ private:
+ static const int32_t CENTER_QUORUM;
+ static const int32_t MIN_SKIP;
+ static const int32_t MAX_MODULES;
+ static const int32_t INTEGER_MATH_SHIFT;
+
+ FX_BOOL m_hasSkipped;
+ CBC_CommonBitMatrix* m_image;
+ CFX_Int32Array m_crossCheckStateCount;
+ CFX_ArrayTemplate<CBC_QRFinderPattern*> m_possibleCenters;
};
#endif // XFA_FXBARCODE_QRCODE_BC_QRFINDERPATTERNFINDER_H_