From 1b0023986bc22ce362097b25deb9746b693ef235 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 17 Aug 2015 18:36:43 -0700 Subject: Merge to XFA: Cleanup CFX_UnicodeEncoding and remove IFX_FontEncoding. Similarly, Clean up CFX_UnicodeEncodingEx and remove IFX_FontEncodingEx. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1296753003 . (cherry picked from commit 52a48aadc19b2dee8abeb702269bb168eb6b6999) Review URL: https://codereview.chromium.org/1297083002 . --- xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'xfa/src/fxbarcode/oned') diff --git a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp index aaab954380..8332986bae 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp @@ -20,6 +20,7 @@ * limitations under the License. */ +#include "../../../../third_party/base/nonstd_unique_ptr.h" #include "../barcode.h" #include "../BC_Writer.h" #include "../common/BC_CommonBitMatrix.h" @@ -129,11 +130,9 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, FX_FLOAT geWidth, int32_t fontSize, FX_FLOAT& charsLen) { -#ifdef FXFM_ENCODING_NONE - IFX_FontEncodingEx* encoding = FX_CreateFontEncodingEx(cFont); -#else - IFX_FontEncoding* encoding = FXGE_CreateUnicodeEncoding(cFont); -#endif + nonstd::unique_ptr encoding( + FX_CreateFontEncodingEx(cFont)); + int32_t length = text.GetLength(); FX_DWORD* pCharCode = FX_Alloc(FX_DWORD, text.GetLength()); FX_FLOAT charWidth = 0; @@ -174,8 +173,6 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, (FX_FLOAT)(charPos[i].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f; } FX_Free(pCharCode); - delete encoding; - encoding = NULL; } void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device, const CFX_Matrix* matrix, -- cgit v1.2.3