summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxbarcode')
-rw-r--r--xfa/fxbarcode/BC_TwoDimWriter.cpp13
-rw-r--r--xfa/fxbarcode/BC_TwoDimWriter.h4
-rw-r--r--xfa/fxbarcode/BC_Writer.cpp6
-rw-r--r--xfa/fxbarcode/BC_Writer.h2
-rw-r--r--xfa/fxbarcode/cbc_codabar.cpp3
-rw-r--r--xfa/fxbarcode/cbc_codabar.h3
-rw-r--r--xfa/fxbarcode/cbc_code128.cpp7
-rw-r--r--xfa/fxbarcode/cbc_code128.h3
-rw-r--r--xfa/fxbarcode/cbc_code39.cpp7
-rw-r--r--xfa/fxbarcode/cbc_code39.h3
-rw-r--r--xfa/fxbarcode/cbc_codebase.h3
-rw-r--r--xfa/fxbarcode/cbc_datamatrix.cpp7
-rw-r--r--xfa/fxbarcode/cbc_datamatrix.h3
-rw-r--r--xfa/fxbarcode/cbc_ean13.cpp7
-rw-r--r--xfa/fxbarcode/cbc_ean13.h3
-rw-r--r--xfa/fxbarcode/cbc_ean8.cpp7
-rw-r--r--xfa/fxbarcode/cbc_ean8.h3
-rw-r--r--xfa/fxbarcode/cbc_pdf417i.cpp7
-rw-r--r--xfa/fxbarcode/cbc_pdf417i.h3
-rw-r--r--xfa/fxbarcode/cbc_qrcode.cpp7
-rw-r--r--xfa/fxbarcode/cbc_qrcode.h3
-rw-r--r--xfa/fxbarcode/cbc_upca.cpp7
-rw-r--r--xfa/fxbarcode/cbc_upca.h3
-rw-r--r--xfa/fxbarcode/oned/BC_OneDimWriter.cpp35
-rw-r--r--xfa/fxbarcode/oned/BC_OneDimWriter.h6
-rw-r--r--xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp16
-rw-r--r--xfa/fxbarcode/oned/BC_OnedEAN13Writer.h2
-rw-r--r--xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp17
-rw-r--r--xfa/fxbarcode/oned/BC_OnedEAN8Writer.h2
-rw-r--r--xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp17
-rw-r--r--xfa/fxbarcode/oned/BC_OnedUPCAWriter.h2
31 files changed, 106 insertions, 105 deletions
diff --git a/xfa/fxbarcode/BC_TwoDimWriter.cpp b/xfa/fxbarcode/BC_TwoDimWriter.cpp
index 9c9427aaa5..328352c6c1 100644
--- a/xfa/fxbarcode/BC_TwoDimWriter.cpp
+++ b/xfa/fxbarcode/BC_TwoDimWriter.cpp
@@ -57,9 +57,8 @@ int32_t CBC_TwoDimWriter::GetErrorCorrectionLevel() const {
return m_iCorrectLevel;
}
-void CBC_TwoDimWriter::RenderBitmapResult(
- CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) {
+void CBC_TwoDimWriter::RenderBitmapResult(CFX_DIBitmap*& pOutBitmap,
+ int32_t& e) {
if (m_bFixedSize) {
pOutBitmap = CreateDIBitmap(m_Width, m_Height);
} else {
@@ -83,8 +82,12 @@ void CBC_TwoDimWriter::RenderBitmapResult(
}
}
}
- if (!m_bFixedSize)
- pOutBitmap = pOutBitmap->StretchTo(m_Width, m_Height);
+ if (!m_bFixedSize) {
+ std::unique_ptr<CFX_DIBitmap> pStretchBitmap =
+ pOutBitmap->StretchTo(m_Width, m_Height);
+ delete pOutBitmap;
+ pOutBitmap = pStretchBitmap.release();
+ }
}
void CBC_TwoDimWriter::RenderResult(uint8_t* code,
diff --git a/xfa/fxbarcode/BC_TwoDimWriter.h b/xfa/fxbarcode/BC_TwoDimWriter.h
index c6e0495aec..ad4658b008 100644
--- a/xfa/fxbarcode/BC_TwoDimWriter.h
+++ b/xfa/fxbarcode/BC_TwoDimWriter.h
@@ -23,11 +23,11 @@ class CBC_TwoDimWriter : public CBC_Writer {
int32_t codeWidth,
int32_t codeHeight,
int32_t& e);
- virtual void RenderBitmapResult(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e);
+ virtual void RenderBitmapResult(CFX_DIBitmap*& pOutBitmap, int32_t& e);
virtual void RenderDeviceResult(CFX_RenderDevice* device,
const CFX_Matrix* matrix);
virtual bool SetErrorCorrectionLevel(int32_t level) = 0;
+
int32_t GetErrorCorrectionLevel() const;
protected:
diff --git a/xfa/fxbarcode/BC_Writer.cpp b/xfa/fxbarcode/BC_Writer.cpp
index 69f34148f4..73163522cb 100644
--- a/xfa/fxbarcode/BC_Writer.cpp
+++ b/xfa/fxbarcode/BC_Writer.cpp
@@ -49,10 +49,8 @@ void CBC_Writer::SetBackgroundColor(FX_ARGB backgroundColor) {
void CBC_Writer::SetBarcodeColor(FX_ARGB foregroundColor) {
m_barColor = foregroundColor;
}
-
-CFX_RetainPtr<CFX_DIBitmap> CBC_Writer::CreateDIBitmap(int32_t width,
- int32_t height) {
- auto pDIBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+CFX_DIBitmap* CBC_Writer::CreateDIBitmap(int32_t width, int32_t height) {
+ CFX_DIBitmap* pDIBitmap = new CFX_DIBitmap;
pDIBitmap->Create(width, height, m_colorSpace);
return pDIBitmap;
}
diff --git a/xfa/fxbarcode/BC_Writer.h b/xfa/fxbarcode/BC_Writer.h
index 8dd03ead58..90ea06a397 100644
--- a/xfa/fxbarcode/BC_Writer.h
+++ b/xfa/fxbarcode/BC_Writer.h
@@ -24,7 +24,7 @@ class CBC_Writer {
virtual void SetBarcodeColor(FX_ARGB foregroundColor);
protected:
- CFX_RetainPtr<CFX_DIBitmap> CreateDIBitmap(int32_t width, int32_t height);
+ CFX_DIBitmap* CreateDIBitmap(int32_t width, int32_t height);
int32_t m_CharEncoding;
int32_t m_ModuleHeight;
int32_t m_ModuleWidth;
diff --git a/xfa/fxbarcode/cbc_codabar.cpp b/xfa/fxbarcode/cbc_codabar.cpp
index c49fe95948..53e351d5a2 100644
--- a/xfa/fxbarcode/cbc_codabar.cpp
+++ b/xfa/fxbarcode/cbc_codabar.cpp
@@ -93,8 +93,7 @@ bool CBC_Codabar::RenderDevice(CFX_RenderDevice* device,
return true;
}
-bool CBC_Codabar::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) {
+bool CBC_Codabar::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
CFX_WideString renderCon =
static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
->encodedContents(m_renderContents.AsStringC());
diff --git a/xfa/fxbarcode/cbc_codabar.h b/xfa/fxbarcode/cbc_codabar.h
index f00c295f44..43f1a010c0 100644
--- a/xfa/fxbarcode/cbc_codabar.h
+++ b/xfa/fxbarcode/cbc_codabar.h
@@ -24,8 +24,7 @@ class CBC_Codabar : public CBC_OneCode {
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t& e) override;
- bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) override;
+ bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
BC_TYPE GetType() override;
bool SetStartChar(char start);
diff --git a/xfa/fxbarcode/cbc_code128.cpp b/xfa/fxbarcode/cbc_code128.cpp
index ea0bc56fce..35bd136fd0 100644
--- a/xfa/fxbarcode/cbc_code128.cpp
+++ b/xfa/fxbarcode/cbc_code128.cpp
@@ -78,11 +78,12 @@ bool CBC_Code128::RenderDevice(CFX_RenderDevice* device,
return true;
}
-bool CBC_Code128::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) {
+bool CBC_Code128::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
- return e == BCExceptionNO;
+ if (e != BCExceptionNO)
+ return false;
+ return true;
}
BC_TYPE CBC_Code128::GetType() {
diff --git a/xfa/fxbarcode/cbc_code128.h b/xfa/fxbarcode/cbc_code128.h
index d8505760a6..0dd9c84f68 100644
--- a/xfa/fxbarcode/cbc_code128.h
+++ b/xfa/fxbarcode/cbc_code128.h
@@ -24,8 +24,7 @@ class CBC_Code128 : public CBC_OneCode {
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t& e) override;
- bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) override;
+ bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
BC_TYPE GetType() override;
bool SetTextLocation(BC_TEXT_LOC loction);
diff --git a/xfa/fxbarcode/cbc_code39.cpp b/xfa/fxbarcode/cbc_code39.cpp
index e3cfccbd90..af45ad4063 100644
--- a/xfa/fxbarcode/cbc_code39.cpp
+++ b/xfa/fxbarcode/cbc_code39.cpp
@@ -70,14 +70,15 @@ bool CBC_Code39::RenderDevice(CFX_RenderDevice* device,
return true;
}
-bool CBC_Code39::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) {
+bool CBC_Code39::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
CFX_WideString renderCon =
static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
->encodedContents(m_renderContents.AsStringC(), e);
static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
->RenderBitmapResult(pOutBitmap, renderCon.AsStringC(), e);
- return e == BCExceptionNO;
+ if (e != BCExceptionNO)
+ return false;
+ return true;
}
BC_TYPE CBC_Code39::GetType() {
diff --git a/xfa/fxbarcode/cbc_code39.h b/xfa/fxbarcode/cbc_code39.h
index 0320211631..7f5c627c6c 100644
--- a/xfa/fxbarcode/cbc_code39.h
+++ b/xfa/fxbarcode/cbc_code39.h
@@ -24,8 +24,7 @@ class CBC_Code39 : public CBC_OneCode {
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t& e) override;
- bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) override;
+ bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
BC_TYPE GetType() override;
bool SetTextLocation(BC_TEXT_LOC location);
diff --git a/xfa/fxbarcode/cbc_codebase.h b/xfa/fxbarcode/cbc_codebase.h
index 37a65d2cf6..c28c08b7e7 100644
--- a/xfa/fxbarcode/cbc_codebase.h
+++ b/xfa/fxbarcode/cbc_codebase.h
@@ -30,8 +30,7 @@ class CBC_CodeBase {
virtual bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t& e) = 0;
- virtual bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) = 0;
+ virtual bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) = 0;
bool SetCharEncoding(int32_t encoding);
bool SetModuleHeight(int32_t moduleHeight);
diff --git a/xfa/fxbarcode/cbc_datamatrix.cpp b/xfa/fxbarcode/cbc_datamatrix.cpp
index ebfa8b9901..6122368e84 100644
--- a/xfa/fxbarcode/cbc_datamatrix.cpp
+++ b/xfa/fxbarcode/cbc_datamatrix.cpp
@@ -53,11 +53,12 @@ bool CBC_DataMatrix::RenderDevice(CFX_RenderDevice* device,
return true;
}
-bool CBC_DataMatrix::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) {
+bool CBC_DataMatrix::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
->RenderBitmapResult(pOutBitmap, e);
- return e == BCExceptionNO;
+ if (e != BCExceptionNO)
+ return false;
+ return true;
}
BC_TYPE CBC_DataMatrix::GetType() {
diff --git a/xfa/fxbarcode/cbc_datamatrix.h b/xfa/fxbarcode/cbc_datamatrix.h
index ebca372f3f..661b48d744 100644
--- a/xfa/fxbarcode/cbc_datamatrix.h
+++ b/xfa/fxbarcode/cbc_datamatrix.h
@@ -24,8 +24,7 @@ class CBC_DataMatrix : public CBC_CodeBase {
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t& e) override;
- bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) override;
+ bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
BC_TYPE GetType() override;
};
diff --git a/xfa/fxbarcode/cbc_ean13.cpp b/xfa/fxbarcode/cbc_ean13.cpp
index afe52db9dd..abd5f198a3 100644
--- a/xfa/fxbarcode/cbc_ean13.cpp
+++ b/xfa/fxbarcode/cbc_ean13.cpp
@@ -83,11 +83,12 @@ bool CBC_EAN13::RenderDevice(CFX_RenderDevice* device,
return true;
}
-bool CBC_EAN13::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) {
+bool CBC_EAN13::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
- return e == BCExceptionNO;
+ if (e != BCExceptionNO)
+ return false;
+ return true;
}
BC_TYPE CBC_EAN13::GetType() {
diff --git a/xfa/fxbarcode/cbc_ean13.h b/xfa/fxbarcode/cbc_ean13.h
index 5f23855ead..f0e7940a04 100644
--- a/xfa/fxbarcode/cbc_ean13.h
+++ b/xfa/fxbarcode/cbc_ean13.h
@@ -24,8 +24,7 @@ class CBC_EAN13 : public CBC_OneCode {
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t& e) override;
- bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) override;
+ bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
BC_TYPE GetType() override;
private:
diff --git a/xfa/fxbarcode/cbc_ean8.cpp b/xfa/fxbarcode/cbc_ean8.cpp
index 408b43a608..bfb458521e 100644
--- a/xfa/fxbarcode/cbc_ean8.cpp
+++ b/xfa/fxbarcode/cbc_ean8.cpp
@@ -82,11 +82,12 @@ bool CBC_EAN8::RenderDevice(CFX_RenderDevice* device,
return true;
}
-bool CBC_EAN8::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) {
+bool CBC_EAN8::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
- return e == BCExceptionNO;
+ if (e != BCExceptionNO)
+ return false;
+ return true;
}
BC_TYPE CBC_EAN8::GetType() {
diff --git a/xfa/fxbarcode/cbc_ean8.h b/xfa/fxbarcode/cbc_ean8.h
index 478a67405c..6a475cb795 100644
--- a/xfa/fxbarcode/cbc_ean8.h
+++ b/xfa/fxbarcode/cbc_ean8.h
@@ -24,8 +24,7 @@ class CBC_EAN8 : public CBC_OneCode {
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t& e) override;
- bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) override;
+ bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
BC_TYPE GetType() override;
private:
diff --git a/xfa/fxbarcode/cbc_pdf417i.cpp b/xfa/fxbarcode/cbc_pdf417i.cpp
index a5e210757a..1c5547d445 100644
--- a/xfa/fxbarcode/cbc_pdf417i.cpp
+++ b/xfa/fxbarcode/cbc_pdf417i.cpp
@@ -63,11 +63,12 @@ bool CBC_PDF417I::RenderDevice(CFX_RenderDevice* device,
return true;
}
-bool CBC_PDF417I::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) {
+bool CBC_PDF417I::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
->RenderBitmapResult(pOutBitmap, e);
- return e == BCExceptionNO;
+ if (e != BCExceptionNO)
+ return false;
+ return true;
}
BC_TYPE CBC_PDF417I::GetType() {
diff --git a/xfa/fxbarcode/cbc_pdf417i.h b/xfa/fxbarcode/cbc_pdf417i.h
index c26dceeebd..70ea929820 100644
--- a/xfa/fxbarcode/cbc_pdf417i.h
+++ b/xfa/fxbarcode/cbc_pdf417i.h
@@ -24,8 +24,7 @@ class CBC_PDF417I : public CBC_CodeBase {
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t& e) override;
- bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) override;
+ bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
BC_TYPE GetType() override;
bool SetErrorCorrectionLevel(int32_t level);
diff --git a/xfa/fxbarcode/cbc_qrcode.cpp b/xfa/fxbarcode/cbc_qrcode.cpp
index e046857b6b..26b74ca400 100644
--- a/xfa/fxbarcode/cbc_qrcode.cpp
+++ b/xfa/fxbarcode/cbc_qrcode.cpp
@@ -69,11 +69,12 @@ bool CBC_QRCode::RenderDevice(CFX_RenderDevice* device,
return true;
}
-bool CBC_QRCode::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) {
+bool CBC_QRCode::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
->RenderBitmapResult(pOutBitmap, e);
- return e == BCExceptionNO;
+ if (e != BCExceptionNO)
+ return false;
+ return true;
}
BC_TYPE CBC_QRCode::GetType() {
diff --git a/xfa/fxbarcode/cbc_qrcode.h b/xfa/fxbarcode/cbc_qrcode.h
index 05f3f6c415..ac2d93d915 100644
--- a/xfa/fxbarcode/cbc_qrcode.h
+++ b/xfa/fxbarcode/cbc_qrcode.h
@@ -24,8 +24,7 @@ class CBC_QRCode : public CBC_CodeBase {
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t& e) override;
- bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) override;
+ bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
BC_TYPE GetType() override;
bool SetVersion(int32_t version);
diff --git a/xfa/fxbarcode/cbc_upca.cpp b/xfa/fxbarcode/cbc_upca.cpp
index 915a6aead5..87f58093ae 100644
--- a/xfa/fxbarcode/cbc_upca.cpp
+++ b/xfa/fxbarcode/cbc_upca.cpp
@@ -86,11 +86,12 @@ bool CBC_UPCA::RenderDevice(CFX_RenderDevice* device,
return true;
}
-bool CBC_UPCA::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) {
+bool CBC_UPCA::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
- return e == BCExceptionNO;
+ if (e != BCExceptionNO)
+ return false;
+ return true;
}
BC_TYPE CBC_UPCA::GetType() {
diff --git a/xfa/fxbarcode/cbc_upca.h b/xfa/fxbarcode/cbc_upca.h
index 4015a3143d..bf90b922b5 100644
--- a/xfa/fxbarcode/cbc_upca.h
+++ b/xfa/fxbarcode/cbc_upca.h
@@ -24,8 +24,7 @@ class CBC_UPCA : public CBC_OneCode {
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t& e) override;
- bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- int32_t& e) override;
+ bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
BC_TYPE GetType() override;
private:
diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
index 16eba2df10..02ae58dc84 100644
--- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -224,14 +224,13 @@ void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device,
m_fontColor, FXTEXT_CLEARTYPE);
}
-void CBC_OneDimWriter::ShowBitmapChars(
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- const CFX_ByteString str,
- float geWidth,
- FXTEXT_CHARPOS* pCharPos,
- float locX,
- float locY,
- int32_t barWidth) {
+void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap,
+ const CFX_ByteString str,
+ float geWidth,
+ FXTEXT_CHARPOS* pCharPos,
+ float locX,
+ float locY,
+ int32_t barWidth) {
int32_t iFontSize = (int32_t)fabs(m_fFontSize);
int32_t iTextHeight = iFontSize + 1;
CFX_FxgeDevice ge;
@@ -249,7 +248,7 @@ void CBC_OneDimWriter::ShowBitmapChars(
}
void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_DIBitmap* pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
@@ -317,10 +316,9 @@ void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
FX_Free(pCharPos);
}
-void CBC_OneDimWriter::RenderBitmapResult(
- CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- const CFX_WideStringC& contents,
- int32_t& e) {
+void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap*& pOutBitmap,
+ const CFX_WideStringC& contents,
+ int32_t& e) {
if (!m_output)
if (e != BCExceptionNO)
return;
@@ -339,17 +337,20 @@ void CBC_OneDimWriter::RenderBitmapResult(
}
}
int32_t i = 0;
- for (; i < contents.GetLength(); i++) {
- if (contents.GetAt(i) != ' ')
+ for (; i < contents.GetLength(); i++)
+ if (contents.GetAt(i) != ' ') {
break;
- }
+ }
if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) {
ShowChars(contents, pOutBitmap, nullptr, nullptr, m_barWidth, m_multiple,
e);
if (e != BCExceptionNO)
return;
}
- pOutBitmap = pOutBitmap->StretchTo(m_Width, m_Height);
+ std::unique_ptr<CFX_DIBitmap> pStretchBitmap =
+ pOutBitmap->StretchTo(m_Width, m_Height);
+ delete pOutBitmap;
+ pOutBitmap = pStretchBitmap.release();
}
void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.h b/xfa/fxbarcode/oned/BC_OneDimWriter.h
index 4892889ddb..b2447cffb7 100644
--- a/xfa/fxbarcode/oned/BC_OneDimWriter.h
+++ b/xfa/fxbarcode/oned/BC_OneDimWriter.h
@@ -42,7 +42,7 @@ class CBC_OneDimWriter : public CBC_Writer {
int32_t codeLength,
bool isDevice,
int32_t& e);
- virtual void RenderBitmapResult(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ virtual void RenderBitmapResult(CFX_DIBitmap*& pOutBitmap,
const CFX_WideStringC& contents,
int32_t& e);
virtual void RenderDeviceResult(CFX_RenderDevice* device,
@@ -68,13 +68,13 @@ class CBC_OneDimWriter : public CBC_Writer {
int32_t fontSize,
float& charsLen);
virtual void ShowChars(const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_DIBitmap* pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
int32_t multiple,
int32_t& e);
- virtual void ShowBitmapChars(const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ virtual void ShowBitmapChars(CFX_DIBitmap* pOutBitmap,
const CFX_ByteString str,
float geWidth,
FXTEXT_CHARPOS* pCharPos,
diff --git a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index dcea777089..555b58643d 100644
--- a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -167,14 +167,13 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents,
return result;
}
-void CBC_OnedEAN13Writer::ShowChars(
- const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t barWidth,
- int32_t multiple,
- int32_t& e) {
+void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
+ CFX_DIBitmap* pOutBitmap,
+ CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t barWidth,
+ int32_t multiple,
+ int32_t& e) {
if (!device && !pOutBitmap) {
e = BCExceptionIllegalArgument;
return;
@@ -279,6 +278,7 @@ void CBC_OnedEAN13Writer::ShowChars(
CalcTextInfo(tempStr, pCharPos, m_pFont, (float)strWidth, iFontSize, blank);
if (pOutBitmap) {
+ delete ge.GetBitmap();
ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize),
diff --git a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.h b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.h
index 8336259568..5775f89046 100644
--- a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.h
+++ b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.h
@@ -46,7 +46,7 @@ class CBC_OnedEAN13Writer : public CBC_OneDimWriter {
protected:
void ShowChars(const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_DIBitmap* pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index a7fa30c811..5f571c2a30 100644
--- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -165,14 +165,13 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents,
return result;
}
-void CBC_OnedEAN8Writer::ShowChars(
- const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t barWidth,
- int32_t multiple,
- int32_t& e) {
+void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
+ CFX_DIBitmap* pOutBitmap,
+ CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t barWidth,
+ int32_t multiple,
+ int32_t& e) {
if (!device && !pOutBitmap) {
e = BCExceptionIllegalArgument;
return;
@@ -218,6 +217,7 @@ void CBC_OnedEAN8Writer::ShowChars(
CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (float)iFontSize);
CFX_FxgeDevice ge;
if (pOutBitmap) {
+ delete ge.GetBitmap();
ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize),
@@ -237,6 +237,7 @@ void CBC_OnedEAN8Writer::ShowChars(
CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (float)strWidth, iFontSize,
blank);
if (pOutBitmap) {
+ delete ge.GetBitmap();
ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
ge.DrawNormalText(iLen, pCharPos + 4, m_pFont,
diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.h b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.h
index b9921babc3..844fc33afa 100644
--- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.h
+++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.h
@@ -50,7 +50,7 @@ class CBC_OnedEAN8Writer : public CBC_OneDimWriter {
protected:
void ShowChars(const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_DIBitmap* pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index 540e852d5d..cefae97d8d 100644
--- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -117,14 +117,13 @@ uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents,
return nullptr;
}
-void CBC_OnedUPCAWriter::ShowChars(
- const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t barWidth,
- int32_t multiple,
- int32_t& e) {
+void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
+ CFX_DIBitmap* pOutBitmap,
+ CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t barWidth,
+ int32_t multiple,
+ int32_t& e) {
if (!device && !pOutBitmap) {
e = BCExceptionIllegalArgument;
return;
@@ -236,6 +235,7 @@ void CBC_OnedUPCAWriter::ShowChars(
CalcTextInfo(tempStr, pCharPos, m_pFont, strWidth, iFontSize, blank);
if (pOutBitmap) {
+ delete ge.GetBitmap();
ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize),
@@ -255,6 +255,7 @@ void CBC_OnedUPCAWriter::ShowChars(
iLen = tempStr.GetLength();
CalcTextInfo(tempStr, pCharPos + 11, m_pFont, strWidth, iFontSize, blank);
if (pOutBitmap) {
+ delete ge.GetBitmap();
ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
ge.DrawNormalText(iLen, pCharPos + 11, m_pFont,
diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.h b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.h
index 6c0929a051..6b786ce3b8 100644
--- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.h
+++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.h
@@ -52,7 +52,7 @@ class CBC_OnedUPCAWriter : public CBC_OneDimWriter {
protected:
void ShowChars(const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_DIBitmap* pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,