Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Unified Diff: xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp

Issue 1297083002: Merge to XFA: Cleanup CFX_UnicodeEncoding and remove IFX_FontEncoding. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: nits Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/src/fgas/src/font/fx_gefont.cpp ('k') | xfa/src/fxgraphics/src/fx_graphics.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
index aaab954380c4e5452d35733f2796fa6a2e786da1..8332986bae4da40f65c66738457e9ea6ab729a2c 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<CFX_UnicodeEncodingEx> 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,
« no previous file with comments | « xfa/src/fgas/src/font/fx_gefont.cpp ('k') | xfa/src/fxgraphics/src/fx_graphics.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698