summaryrefslogtreecommitdiff
path: root/fxbarcode
diff options
context:
space:
mode:
Diffstat (limited to 'fxbarcode')
-rw-r--r--fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp10
-rw-r--r--fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h2
-rw-r--r--fxbarcode/datamatrix/BC_EncoderContext.h3
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.cpp5
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.h3
-rw-r--r--fxbarcode/oned/BC_OnedEAN13Writer.cpp14
-rw-r--r--fxbarcode/oned/BC_OnedEAN8Writer.cpp10
-rw-r--r--fxbarcode/oned/BC_OnedUPCAWriter.cpp18
-rw-r--r--fxbarcode/qrcode/BC_QRCoder.cpp4
-rw-r--r--fxbarcode/qrcode/BC_QRCoder.h6
10 files changed, 41 insertions, 34 deletions
diff --git a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
index 5c26188f53..ef83691d4f 100644
--- a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
+++ b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
@@ -106,7 +106,7 @@ int32_t CBC_ReedSolomonGF256Poly::EvaluateAt(int32_t a) {
std::unique_ptr<CBC_ReedSolomonGF256Poly> CBC_ReedSolomonGF256Poly::Clone()
const {
auto temp = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>();
- if (!temp->Init(m_field, &m_coefficients))
+ if (!temp->Init(m_field.Get(), &m_coefficients))
return nullptr;
return temp;
}
@@ -133,7 +133,7 @@ CBC_ReedSolomonGF256Poly::AddOrSubtract(const CBC_ReedSolomonGF256Poly* other) {
smallerCoefficients[j - lengthDiff], largerCoefficients[j]);
}
auto temp = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>();
- if (!temp->Init(m_field, &sumDiff))
+ if (!temp->Init(m_field.Get(), &sumDiff))
return nullptr;
return temp;
}
@@ -156,7 +156,7 @@ std::unique_ptr<CBC_ReedSolomonGF256Poly> CBC_ReedSolomonGF256Poly::Multiply(
}
}
auto temp = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>();
- if (!temp->Init(m_field, &product))
+ if (!temp->Init(m_field.Get(), &product))
return nullptr;
return temp;
}
@@ -174,7 +174,7 @@ std::unique_ptr<CBC_ReedSolomonGF256Poly> CBC_ReedSolomonGF256Poly::Multiply(
product[i] = m_field->Multiply(m_coefficients[i], scalar);
auto temp = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>();
- if (!temp->Init(m_field, &product))
+ if (!temp->Init(m_field.Get(), &product))
return nullptr;
return temp;
}
@@ -193,7 +193,7 @@ CBC_ReedSolomonGF256Poly::MultiplyByMonomial(int32_t degree,
product[i] = m_field->Multiply(m_coefficients[i], coefficient);
auto temp = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>();
- if (!temp->Init(m_field, &product))
+ if (!temp->Init(m_field.Get(), &product))
return nullptr;
return temp;
}
diff --git a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h
index ce8a572704..f7aea2bf53 100644
--- a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h
+++ b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h
@@ -40,7 +40,7 @@ class CBC_ReedSolomonGF256Poly final {
std::unique_ptr<CBC_ReedSolomonGF256Poly> Clone() const;
private:
- CBC_ReedSolomonGF256* m_field;
+ CFX_UnownedPtr<CBC_ReedSolomonGF256> m_field;
std::vector<int32_t> m_coefficients;
};
diff --git a/fxbarcode/datamatrix/BC_EncoderContext.h b/fxbarcode/datamatrix/BC_EncoderContext.h
index 6cb2b42fa9..21ea695c3d 100644
--- a/fxbarcode/datamatrix/BC_EncoderContext.h
+++ b/fxbarcode/datamatrix/BC_EncoderContext.h
@@ -7,6 +7,7 @@
#ifndef FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
#define FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/cfx_widestring.h"
#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
@@ -38,7 +39,7 @@ class CBC_EncoderContext {
CFX_WideString m_codewords;
int32_t m_pos;
int32_t m_newEncoding;
- CBC_SymbolInfo* m_symbolInfo;
+ CFX_UnownedPtr<CBC_SymbolInfo> m_symbolInfo;
private:
int32_t getTotalMessageCharCount();
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index a7539e4897..22cc09513f 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -197,7 +197,7 @@ void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device,
if (matrix) {
affine_matrix.Concat(*matrix);
}
- device->DrawNormalText(str.GetLength(), pCharPos, m_pFont,
+ device->DrawNormalText(str.GetLength(), pCharPos, m_pFont.Get(),
static_cast<float>(iFontSize), &affine_matrix,
m_fontColor, FXTEXT_CLEARTYPE);
}
@@ -224,7 +224,8 @@ bool CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
}
int32_t iFontSize = (int32_t)fabs(m_fFontSize);
int32_t iTextHeight = iFontSize + 1;
- CalcTextInfo(str, charpos.data(), m_pFont, geWidth, iFontSize, charsLen);
+ CalcTextInfo(str, charpos.data(), m_pFont.Get(), geWidth, iFontSize,
+ charsLen);
if (charsLen < 1)
return true;
diff --git a/fxbarcode/oned/BC_OneDimWriter.h b/fxbarcode/oned/BC_OneDimWriter.h
index 3bd1b611c6..d81a3e0a0a 100644
--- a/fxbarcode/oned/BC_OneDimWriter.h
+++ b/fxbarcode/oned/BC_OneDimWriter.h
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxge/cfx_renderdevice.h"
#include "fxbarcode/BC_Library.h"
#include "fxbarcode/BC_Writer.h"
@@ -86,7 +87,7 @@ class CBC_OneDimWriter : public CBC_Writer {
bool m_bPrintChecksum;
int32_t m_iDataLenth;
bool m_bCalcChecksum;
- CFX_Font* m_pFont;
+ CFX_UnownedPtr<CFX_Font> m_pFont;
float m_fFontSize;
int32_t m_iFontStyle;
uint32_t m_fontColor;
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index bae43b464e..0e4bab9518 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -192,7 +192,7 @@ bool CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
iLen = tempStr.GetLength();
strWidth = (int32_t)(strWidth * m_outputHScale);
- CalcTextInfo(tempStr, &charpos[1], m_pFont, (float)strWidth, iFontSize,
+ CalcTextInfo(tempStr, &charpos[1], m_pFont.Get(), (float)strWidth, iFontSize,
blank);
{
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
@@ -200,13 +200,13 @@ bool CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
(float)(m_Height - iTextHeight) + iFontSize);
if (matrix)
affine_matrix1.Concat(*matrix);
- device->DrawNormalText(iLen, &charpos[1], m_pFont,
+ device->DrawNormalText(iLen, &charpos[1], m_pFont.Get(),
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
}
tempStr = str.Mid(7, 6);
iLen = tempStr.GetLength();
- CalcTextInfo(tempStr, &charpos[7], m_pFont, (float)strWidth, iFontSize,
+ CalcTextInfo(tempStr, &charpos[7], m_pFont.Get(), (float)strWidth, iFontSize,
blank);
{
CFX_Matrix affine_matrix1(
@@ -215,7 +215,7 @@ bool CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
(float)(m_Height - iTextHeight + iFontSize));
if (matrix)
affine_matrix1.Concat(*matrix);
- device->DrawNormalText(iLen, &charpos[7], m_pFont,
+ device->DrawNormalText(iLen, &charpos[7], m_pFont.Get(),
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
}
@@ -224,14 +224,14 @@ bool CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
strWidth = multiple * 7;
strWidth = (int32_t)(strWidth * m_outputHScale);
- CalcTextInfo(tempStr, charpos.data(), m_pFont, (float)strWidth, iFontSize,
- blank);
+ CalcTextInfo(tempStr, charpos.data(), m_pFont.Get(), (float)strWidth,
+ iFontSize, blank);
{
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0.0,
(float)(m_Height - iTextHeight + iFontSize));
if (matrix)
affine_matrix1.Concat(*matrix);
- device->DrawNormalText(iLen, charpos.data(), m_pFont,
+ device->DrawNormalText(iLen, charpos.data(), m_pFont.Get(),
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
}
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index 49d77b72c4..f891c08fc6 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -184,20 +184,20 @@ bool CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
device->FillRect(&re, m_backgroundColor);
strWidth = (int32_t)(strWidth * m_outputHScale);
- CalcTextInfo(tempStr, charpos.data(), m_pFont, (float)strWidth, iFontSize,
- blank);
+ CalcTextInfo(tempStr, charpos.data(), m_pFont.Get(), (float)strWidth,
+ iFontSize, blank);
{
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
(float)leftPosition * m_outputHScale,
(float)(m_Height - iTextHeight + iFontSize));
affine_matrix1.Concat(*matrix);
- device->DrawNormalText(iLen, charpos.data(), m_pFont,
+ device->DrawNormalText(iLen, charpos.data(), m_pFont.Get(),
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
}
tempStr = str.Mid(4, 4);
iLen = tempStr.GetLength();
- CalcTextInfo(tempStr, &charpos[4], m_pFont, (float)strWidth, iFontSize,
+ CalcTextInfo(tempStr, &charpos[4], m_pFont.Get(), (float)strWidth, iFontSize,
blank);
{
CFX_Matrix affine_matrix1(
@@ -206,7 +206,7 @@ bool CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
(float)(m_Height - iTextHeight + iFontSize));
if (matrix)
affine_matrix1.Concat(*matrix);
- device->DrawNormalText(iLen, &charpos[4], m_pFont,
+ device->DrawNormalText(iLen, &charpos[4], m_pFont.Get(),
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
}
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index 614268e742..78ada1783a 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -158,20 +158,20 @@ bool CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
device->FillRect(&re, m_backgroundColor);
strWidth = strWidth * m_outputHScale;
- CalcTextInfo(tempStr, &charpos[1], m_pFont, strWidth, iFontSize, blank);
+ CalcTextInfo(tempStr, &charpos[1], m_pFont.Get(), strWidth, iFontSize, blank);
{
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
(float)leftPosition * m_outputHScale,
(float)(m_Height - iTextHeight + iFontSize));
if (matrix)
affine_matrix1.Concat(*matrix);
- device->DrawNormalText(iLen, &charpos[1], m_pFont,
+ device->DrawNormalText(iLen, &charpos[1], m_pFont.Get(),
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
}
tempStr = str.Mid(6, 5);
iLen = tempStr.GetLength();
- CalcTextInfo(tempStr, &charpos[6], m_pFont, strWidth, iFontSize, blank);
+ CalcTextInfo(tempStr, &charpos[6], m_pFont.Get(), strWidth, iFontSize, blank);
{
CFX_Matrix affine_matrix1(
1.0, 0.0, 0.0, -1.0,
@@ -179,7 +179,7 @@ bool CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
(float)(m_Height - iTextHeight + iFontSize));
if (matrix)
affine_matrix1.Concat(*matrix);
- device->DrawNormalText(iLen, &charpos[6], m_pFont,
+ device->DrawNormalText(iLen, &charpos[6], m_pFont.Get(),
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
}
@@ -188,19 +188,21 @@ bool CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
strWidth = (float)multiple * 7;
strWidth = strWidth * m_outputHScale;
- CalcTextInfo(tempStr, charpos.data(), m_pFont, strWidth, iFontSize, blank);
+ CalcTextInfo(tempStr, charpos.data(), m_pFont.Get(), strWidth, iFontSize,
+ blank);
{
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0,
(float)(m_Height - iTextHeight + iFontSize));
if (matrix)
affine_matrix1.Concat(*matrix);
- device->DrawNormalText(iLen, charpos.data(), m_pFont,
+ device->DrawNormalText(iLen, charpos.data(), m_pFont.Get(),
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
}
tempStr = str.Mid(11, 1);
iLen = tempStr.GetLength();
- CalcTextInfo(tempStr, &charpos[11], m_pFont, strWidth, iFontSize, blank);
+ CalcTextInfo(tempStr, &charpos[11], m_pFont.Get(), strWidth, iFontSize,
+ blank);
{
CFX_Matrix affine_matrix1(
1.0, 0.0, 0.0, -1.0,
@@ -208,7 +210,7 @@ bool CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
(float)(m_Height - iTextHeight + iFontSize));
if (matrix)
affine_matrix1.Concat(*matrix);
- device->DrawNormalText(iLen, &charpos[11], m_pFont,
+ device->DrawNormalText(iLen, &charpos[11], m_pFont.Get(),
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
}
diff --git a/fxbarcode/qrcode/BC_QRCoder.cpp b/fxbarcode/qrcode/BC_QRCoder.cpp
index e3ac763499..b0a24fa27c 100644
--- a/fxbarcode/qrcode/BC_QRCoder.cpp
+++ b/fxbarcode/qrcode/BC_QRCoder.cpp
@@ -42,11 +42,11 @@ CBC_QRCoder::CBC_QRCoder()
CBC_QRCoder::~CBC_QRCoder() {}
CBC_QRCoderMode* CBC_QRCoder::GetMode() const {
- return m_mode;
+ return m_mode.Get();
}
const CBC_QRCoderErrorCorrectionLevel* CBC_QRCoder::GetECLevel() const {
- return m_ecLevel;
+ return m_ecLevel.Get();
}
int32_t CBC_QRCoder::GetVersion() const {
diff --git a/fxbarcode/qrcode/BC_QRCoder.h b/fxbarcode/qrcode/BC_QRCoder.h
index adeae6c521..fe34b5250b 100644
--- a/fxbarcode/qrcode/BC_QRCoder.h
+++ b/fxbarcode/qrcode/BC_QRCoder.h
@@ -9,6 +9,8 @@
#include <memory>
+#include "core/fxcrt/cfx_unowned_ptr.h"
+
class CBC_QRCoderErrorCorrectionLevel;
class CBC_QRCoderMode;
class CBC_CommonByteMatrix;
@@ -48,8 +50,8 @@ class CBC_QRCoder {
void SetMatrix(std::unique_ptr<CBC_CommonByteMatrix> pMatrix);
private:
- CBC_QRCoderMode* m_mode;
- const CBC_QRCoderErrorCorrectionLevel* m_ecLevel;
+ CFX_UnownedPtr<CBC_QRCoderMode> m_mode;
+ CFX_UnownedPtr<const CBC_QRCoderErrorCorrectionLevel> m_ecLevel;
int32_t m_version;
int32_t m_matrixWidth;
int32_t m_maskPattern;