summaryrefslogtreecommitdiff
path: root/xfa/fde/fde_gedevice.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-07-25 07:40:27 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-25 07:40:27 -0700
commit9b671ace8aec906683b05399cf8a2882ed8ef7b6 (patch)
treeca6193f08a18ffe917301fd523c6c668becb7bdb /xfa/fde/fde_gedevice.cpp
parentd780735def22c4c2ec3a0cc89856c86486c25494 (diff)
downloadpdfium-9b671ace8aec906683b05399cf8a2882ed8ef7b6.tar.xz
Use smart pointers for CFX_Font and CFX_Type3Font classes
For the class owned member variables, use std::unique_ptr or std::vector for memory management. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2169793002
Diffstat (limited to 'xfa/fde/fde_gedevice.cpp')
-rw-r--r--xfa/fde/fde_gedevice.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp
index e78ab8da4c..56f845c35b 100644
--- a/xfa/fde/fde_gedevice.cpp
+++ b/xfa/fde/fde_gedevice.cpp
@@ -134,12 +134,12 @@ FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
uint32_t dwFontStyle = pFont->GetFontStyles();
CFX_Font FxFont;
- CFX_SubstFont SubstFxFont;
- FxFont.SetSubstFont(&SubstFxFont);
- SubstFxFont.m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400;
- SubstFxFont.m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0;
- SubstFxFont.m_WeightCJK = SubstFxFont.m_Weight;
- SubstFxFont.m_bItalicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic);
+ CFX_SubstFont* SubstFxFont = new CFX_SubstFont();
+ FxFont.SetSubstFont(std::unique_ptr<CFX_SubstFont>(SubstFxFont));
+ SubstFxFont->m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400;
+ SubstFxFont->m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0;
+ SubstFxFont->m_WeightCJK = SubstFxFont->m_Weight;
+ SubstFxFont->m_bItalicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic);
#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
for (int32_t i = 0; i < iCount; ++i) {
@@ -175,7 +175,6 @@ FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
FX_BOOL bRet = m_pDevice->DrawNormalText(
iCurCount, pCurCP, &FxFont, pCache, -fFontSize,
(const CFX_Matrix*)pMatrix, argb, FXTEXT_CLEARTYPE);
- FxFont.SetSubstFont(nullptr);
FxFont.SetFace(nullptr);
return bRet;
#else
@@ -186,7 +185,6 @@ FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
}
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- FxFont.SetSubstFont(nullptr);
FxFont.SetFace(nullptr);
#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_