diff options
Diffstat (limited to 'xfa/fxbarcode/oned')
-rw-r--r-- | xfa/fxbarcode/oned/BC_OneDimWriter.cpp | 35 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OneDimWriter.h | 6 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp | 16 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedEAN13Writer.h | 2 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp | 17 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedEAN8Writer.h | 2 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp | 17 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedUPCAWriter.h | 2 |
8 files changed, 50 insertions, 47 deletions
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, |