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

Unified Diff: xfa/fwl/theme/cfwl_widgettp.cpp

Issue 1960673003: Replace some calls to Release() with direct delete, part 1. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Another unique_ptr. Created 4 years, 7 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/fwl/theme/cfwl_widgettp.h ('k') | xfa/fxfa/app/xfa_ffwidgetacc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fwl/theme/cfwl_widgettp.cpp
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index fb1132beef1e285a50e2e0f295d50cccc17ccfe2..764c86e3141bffd4bf133a144d8054fe35669497 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -83,9 +83,9 @@ FX_BOOL CFWL_WidgetTP::DrawBackground(CFWL_ThemeBackground* pParams) {
return TRUE;
}
FX_BOOL CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) {
- if (!m_pTextOut) {
+ if (!m_pTextOut)
InitTTO();
- }
+
int32_t iLen = pParams->m_wsText.GetLength();
if (iLen <= 0)
return FALSE;
@@ -183,9 +183,8 @@ FWL_Error CFWL_WidgetTP::Initialize() {
return FWL_Error::Succeeded;
}
FWL_Error CFWL_WidgetTP::Finalize() {
- if (!m_pTextOut) {
+ if (!m_pTextOut)
FinalizeTTO();
- }
return FWL_Error::Succeeded;
}
CFWL_WidgetTP::~CFWL_WidgetTP() {}
@@ -193,9 +192,9 @@ FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget,
const FX_WCHAR* strFont,
FX_FLOAT fFontSize,
FX_ARGB rgbFont) {
- if (!m_pTextOut) {
+ if (!m_pTextOut)
return FWL_Error::Succeeded;
- }
+
m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(strFont, 0, 0);
m_pTextOut->SetFont(m_pFDEFont);
m_pTextOut->SetFontSize(fFontSize);
@@ -206,9 +205,9 @@ FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget,
IFX_Font* pFont,
FX_FLOAT fFontSize,
FX_ARGB rgbFont) {
- if (!m_pTextOut) {
+ if (!m_pTextOut)
return FWL_Error::Succeeded;
- }
+
m_pTextOut->SetFont(pFont);
m_pTextOut->SetFontSize(fFontSize);
m_pTextOut->SetTextColor(rgbFont);
@@ -217,26 +216,26 @@ FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget,
IFX_Font* CFWL_WidgetTP::GetFont(IFWL_Widget* pWidget) {
return m_pFDEFont;
}
+
CFWL_WidgetTP::CFWL_WidgetTP()
- : m_dwRefCount(1), m_pTextOut(NULL), m_pFDEFont(NULL), m_dwThemeID(0) {}
+ : m_dwRefCount(1), m_pFDEFont(nullptr), m_dwThemeID(0) {}
+
FWL_Error CFWL_WidgetTP::InitTTO() {
- if (m_pTextOut) {
+ if (m_pTextOut)
return FWL_Error::Succeeded;
- }
+
m_pFDEFont =
CFWL_FontManager::GetInstance()->FindFont(FX_WSTRC(L"Helvetica"), 0, 0);
- m_pTextOut = new CFDE_TextOut;
+ m_pTextOut.reset(new CFDE_TextOut);
m_pTextOut->SetFont(m_pFDEFont);
m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize);
m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
m_pTextOut->SetEllipsisString(L"...");
return FWL_Error::Succeeded;
}
+
FWL_Error CFWL_WidgetTP::FinalizeTTO() {
- if (m_pTextOut) {
- m_pTextOut->Release();
- m_pTextOut = NULL;
- }
+ m_pTextOut.reset();
return FWL_Error::Succeeded;
}
« no previous file with comments | « xfa/fwl/theme/cfwl_widgettp.h ('k') | xfa/fxfa/app/xfa_ffwidgetacc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698