diff options
author | Lei Zhang <thestig@chromium.org> | 2015-08-17 18:36:43 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-08-17 18:36:43 -0700 |
commit | 1b0023986bc22ce362097b25deb9746b693ef235 (patch) | |
tree | 4d18ffc5f9eff4ac4659531621be8d2c28e3c71c /xfa | |
parent | a0f67247277f666d80899985eda3c19f3641b9bf (diff) | |
download | pdfium-1b0023986bc22ce362097b25deb9746b693ef235.tar.xz |
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 .
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/src/fgas/src/font/fx_gefont.cpp | 23 | ||||
-rw-r--r-- | xfa/src/fgas/src/font/fx_gefont.h | 2 | ||||
-rw-r--r-- | xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp | 11 | ||||
-rw-r--r-- | xfa/src/fxgraphics/src/fx_graphics.cpp | 9 | ||||
-rw-r--r-- | xfa/src/fxgraphics/src/fx_path_generator.h | 3 |
5 files changed, 24 insertions, 24 deletions
diff --git a/xfa/src/fgas/src/font/fx_gefont.cpp b/xfa/src/fgas/src/font/fx_gefont.cpp index 8c81f9a8e5..0da6720e2c 100644 --- a/xfa/src/fgas/src/font/fx_gefont.cpp +++ b/xfa/src/fgas/src/font/fx_gefont.cpp @@ -88,6 +88,10 @@ IFX_Font* IFX_Font::LoadFont(CFX_Font* pExtFont, }
CFX_GEFont::CFX_GEFont(IFX_FontMgr* pFontMgr)
: CFX_ThreadLock(),
+#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ m_bUseLogFontStyle(FALSE),
+ m_dwLogFontStyle(0),
+#endif
m_pFont(NULL),
m_pFontMgr(pFontMgr),
m_iRefCount(1),
@@ -98,19 +102,18 @@ CFX_GEFont::CFX_GEFont(IFX_FontMgr* pFontMgr) m_pCharWidthMap(NULL),
m_pRectArray(NULL),
m_pBBoxMap(NULL),
+ m_pProvider(NULL),
m_wCharSet(0xFFFF),
- m_pProvider(NULL)
-#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- ,
- m_bUseLogFontStyle(FALSE),
- m_dwLogFontStyle(0)
-#endif
- ,
m_SubstFonts(),
m_FontMapper(16) {
}
+
CFX_GEFont::CFX_GEFont(const CFX_GEFont& src, FX_DWORD dwFontStyles)
: CFX_ThreadLock(),
+#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ m_bUseLogFontStyle(FALSE),
+ m_dwLogFontStyle(0),
+#endif
m_pFont(NULL),
m_pFontMgr(src.m_pFontMgr),
m_iRefCount(1),
@@ -121,8 +124,8 @@ CFX_GEFont::CFX_GEFont(const CFX_GEFont& src, FX_DWORD dwFontStyles) m_pCharWidthMap(NULL),
m_pRectArray(NULL),
m_pBBoxMap(NULL),
- m_wCharSet(0xFFFF),
m_pProvider(NULL),
+ m_wCharSet(0xFFFF),
m_SubstFonts(),
m_FontMapper(16) {
m_pFont = new CFX_Font;
@@ -334,11 +337,7 @@ void CFX_GEFont::InitFont() { return;
}
if (m_pFontEncoding == NULL) {
-#ifdef FXFM_ENCODING_NONE
m_pFontEncoding = FX_CreateFontEncodingEx(m_pFont);
-#else
- m_pFontEncoding = FXGE_CreateUnicodeEncoding(m_pFont);
-#endif
}
if (m_pCharWidthMap == NULL) {
m_pCharWidthMap = new CFX_WordDiscreteArray(1024);
diff --git a/xfa/src/fgas/src/font/fx_gefont.h b/xfa/src/fgas/src/font/fx_gefont.h index a0c9aa8e02..5620f07bf2 100644 --- a/xfa/src/fgas/src/font/fx_gefont.h +++ b/xfa/src/fgas/src/font/fx_gefont.h @@ -64,7 +64,7 @@ class CFX_GEFont : public IFX_Font, public CFX_ThreadLock { FX_BOOL m_bExtFont;
IFX_Stream* m_pStream;
IFX_FileRead* m_pFileRead;
- IFX_FontEncoding* m_pFontEncoding;
+ CFX_UnicodeEncoding* m_pFontEncoding;
CFX_WordDiscreteArray* m_pCharWidthMap;
CFX_RectMassArray* m_pRectArray;
CFX_MapPtrToPtr* m_pBBoxMap;
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<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,
diff --git a/xfa/src/fxgraphics/src/fx_graphics.cpp b/xfa/src/fxgraphics/src/fx_graphics.cpp index c5eac42e87..df0ecbba22 100644 --- a/xfa/src/fxgraphics/src/fx_graphics.cpp +++ b/xfa/src/fxgraphics/src/fx_graphics.cpp @@ -4,8 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "pre.h"
+#include "../../../../third_party/base/nonstd_unique_ptr.h"
#include "fx_path_generator.h"
+#include "pre.h"
+
class CAGG_Graphics {
public:
CAGG_Graphics();
@@ -1098,7 +1100,8 @@ FX_ERR CFX_Graphics::CalcTextInfo(const CFX_WideString& text, FX_DWORD* charCodes,
FXTEXT_CHARPOS* charPos,
CFX_RectF& rect) {
- IFX_FontEncoding* encoding = FXGE_CreateUnicodeEncoding(_info._font);
+ nonstd::unique_ptr<CFX_UnicodeEncoding> encoding(
+ new CFX_UnicodeEncoding(_info._font));
int32_t length = text.GetLength();
FX_FLOAT penX = (FX_FLOAT)rect.left;
FX_FLOAT penY = (FX_FLOAT)rect.top;
@@ -1135,8 +1138,6 @@ FX_ERR CFX_Graphics::CalcTextInfo(const CFX_WideString& text, }
rect.width = (FX_FLOAT)penX - rect.left;
rect.height = rect.top + _info._fontSize * _info._fontHScale - rect.top;
- delete encoding;
- encoding = NULL;
return FX_ERR_Succeeded;
}
CAGG_Graphics::CAGG_Graphics() {
diff --git a/xfa/src/fxgraphics/src/fx_path_generator.h b/xfa/src/fxgraphics/src/fx_path_generator.h index 7d34fe2d07..663087d4c3 100644 --- a/xfa/src/fxgraphics/src/fx_path_generator.h +++ b/xfa/src/fxgraphics/src/fx_path_generator.h @@ -6,6 +6,9 @@ #ifndef __H_FX_PATH_GENERATOR__
#define __H_FX_PATH_GENERATOR__
+
+#include "../../../../core/include/fxge/fx_ge.h"
+
class CFX_PathGenerator {
public:
CFX_PathGenerator();
|