summaryrefslogtreecommitdiff
path: root/xfa/src/fwl
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-02-25 11:17:16 -0800
committerTom Sepez <tsepez@chromium.org>2016-02-25 11:17:16 -0800
commitea1ae9915d1702ab62af520b1487f70a553fc6ae (patch)
tree2fb77cd9537fa4e5a9b02895343d5abe20b51356 /xfa/src/fwl
parentf014768833406e68234eeb4f8ba94cabf766dff3 (diff)
downloadpdfium-ea1ae9915d1702ab62af520b1487f70a553fc6ae.tar.xz
Make CFX_PSVTemplate simpler.
Add default ctor so we don't have to zero these out. Also, make CFX_VTemplate simpler. Also, remove the Set() method in favor of assignment. Also, remove CFX_FloatPoint define. Also, remove unused (and wrong) CFX_VTemplate methods. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1733523003 .
Diffstat (limited to 'xfa/src/fwl')
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_editimp.cpp9
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_listboximp.cpp2
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp125
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp6
-rw-r--r--xfa/src/fwl/src/core/fwl_formimp.cpp15
-rw-r--r--xfa/src/fwl/src/core/fwl_noteimp.cpp9
-rw-r--r--xfa/src/fwl/src/core/fwl_widgetimp.cpp28
-rw-r--r--xfa/src/fwl/src/lightwidget/tooltipctrl.cpp1
-rw-r--r--xfa/src/fwl/src/lightwidget/widget.cpp11
-rw-r--r--xfa/src/fwl/src/theme/checkboxtp.cpp61
-rw-r--r--xfa/src/fwl/src/theme/widgettp.cpp10
11 files changed, 118 insertions, 159 deletions
diff --git a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
index 38940f2e8d..100a25dde6 100644
--- a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
@@ -1816,8 +1816,7 @@ void CFWL_EditImpDelegate::DoButtonDown(CFWL_MsgMouse* pMsg) {
IFDE_TxtEdtPage* pPage = m_pOwner->m_pEdtEngine->GetPage(0);
if (!pPage)
return;
- CFX_PointF pt;
- pt.Set(pMsg->m_fx, pMsg->m_fy);
+ CFX_PointF pt(pMsg->m_fx, pMsg->m_fy);
m_pOwner->DeviceToEngine(pt);
FX_BOOL bBefore = TRUE;
int32_t nIndex = pPage->GetCharIndex(pt, bBefore);
@@ -1900,8 +1899,7 @@ void CFWL_EditImpDelegate::OnButtonDblClk(CFWL_MsgMouse* pMsg) {
IFDE_TxtEdtPage* pPage = m_pOwner->m_pEdtEngine->GetPage(0);
if (!pPage)
return;
- CFX_PointF pt;
- pt.Set(pMsg->m_fx, pMsg->m_fy);
+ CFX_PointF pt(pMsg->m_fx, pMsg->m_fy);
m_pOwner->DeviceToEngine(pt);
int32_t nCount = 0;
int32_t nIndex = pPage->SelectWord(pt, nCount);
@@ -1922,8 +1920,7 @@ void CFWL_EditImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
IFDE_TxtEdtPage* pPage = m_pOwner->m_pEdtEngine->GetPage(0);
if (!pPage)
return;
- CFX_PointF pt;
- pt.Set(pMsg->m_fx, pMsg->m_fy);
+ CFX_PointF pt(pMsg->m_fx, pMsg->m_fy);
m_pOwner->DeviceToEngine(pt);
FX_BOOL bBefore = TRUE;
int32_t nIndex = pPage->GetCharIndex(pt, bBefore);
diff --git a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp
index 149d3fd0e3..f2885dc25e 100644
--- a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp
@@ -723,9 +723,9 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
}
CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
CFX_SizeF fs;
- fs.Set(0, 0);
if (!m_pProperties->m_pThemeProvider)
return fs;
+
GetClientRect(m_rtClient);
m_rtConent = m_rtClient;
CFX_RectF rtUIMargin;
diff --git a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp
index 264c4b71ed..aee5cb60c3 100644
--- a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp
@@ -6,6 +6,8 @@
#include "xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h"
+#include <algorithm>
+
#include "xfa/include/fwl/basewidget/fwl_monthcalendar.h"
#include "xfa/include/fwl/core/fwl_theme.h"
#include "xfa/src/foxitlib.h"
@@ -75,9 +77,6 @@ CFWL_MonthCalendarImp::CFWL_MonthCalendarImp(
m_rtClient.Reset();
m_rtWeekNum.Reset();
m_rtWeekNumSep.Reset();
- m_szHead.Reset();
- m_szCell.Reset();
- m_szToday.Reset();
m_pDateTime = new CFX_DateTime;
m_bInit = FALSE;
m_iMaxSel = 1;
@@ -498,72 +497,70 @@ void CFWL_MonthCalendarImp::DrawTodayCircle(CFX_Graphics* pGraphics,
pTheme->DrawBackground(&params);
}
CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) {
- CFX_SizeF fs;
- fs.Set(0, 0);
if (!m_pProperties->m_pThemeProvider)
- return fs;
- if (bAutoSize) {
- CFWL_ThemePart params;
- params.m_pWidget = m_pInterface;
- IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
- CFX_WideString* wsText = NULL;
- FX_FLOAT fMaxWeekW = 0.0f;
- FX_FLOAT fMaxWeekH = 0.0f;
- for (FX_DWORD week = FWL_MCCAPACITY_Sun; week <= FWL_MCCAPACITY_Sat;
- week++) {
- wsText = static_cast<CFX_WideString*>(pTheme->GetCapacity(&params, week));
- CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider);
- fMaxWeekW = (fMaxWeekW >= sz.x) ? fMaxWeekW : sz.x;
- fMaxWeekH = (fMaxWeekH >= sz.y) ? fMaxWeekH : sz.y;
- }
- FX_FLOAT fDayMaxW = 0.0f;
- FX_FLOAT fDayMaxH = 0.0f;
- for (int day = 10; day <= 31; day++) {
- CFX_WideString wsDay;
- wsDay.Format(L"%d", day);
- CFX_SizeF sz = CalcTextSize(wsDay, m_pProperties->m_pThemeProvider);
- fDayMaxW = (fDayMaxW >= sz.x) ? fDayMaxW : sz.x;
- fDayMaxH = (fDayMaxH >= sz.y) ? fDayMaxH : sz.y;
- }
- m_szCell.x = FX_FLOAT((fMaxWeekW >= fDayMaxW) ? (int)(fMaxWeekW + 0.5)
- : (int)(fDayMaxW + 0.5));
- m_szCell.y = (fMaxWeekH >= fDayMaxH) ? fMaxWeekH : fDayMaxH;
- fs.x = m_szCell.x * MONTHCAL_COLUMNS +
- MONTHCAL_HMARGIN * MONTHCAL_COLUMNS * 2 +
- MONTHCAL_HEADER_BTN_HMARGIN * 2;
- FX_FLOAT fMonthMaxW = 0.0f;
- FX_FLOAT fMonthMaxH = 0.0f;
- for (FX_DWORD month = FWL_MCCAPACITY_January;
- month <= FWL_MCCAPACITY_December; month++) {
- wsText =
- static_cast<CFX_WideString*>(pTheme->GetCapacity(&params, month));
- CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider);
- fMonthMaxW = (fMonthMaxW >= sz.x) ? fMonthMaxW : sz.x;
- fMonthMaxH = (fMonthMaxH >= sz.y) ? fMonthMaxH : sz.y;
- }
- CFX_WideString wsYear;
- GetHeadText(m_iYear, m_iMonth, wsYear);
- CFX_SizeF szYear = CalcTextSize(wsYear, m_pProperties->m_pThemeProvider);
- fMonthMaxH = (fMonthMaxH >= szYear.y) ? fMonthMaxH : szYear.y;
- m_szHead.Set(fMonthMaxW + szYear.x, fMonthMaxH);
- fMonthMaxW = m_szHead.x + MONTHCAL_HEADER_BTN_HMARGIN * 2 + m_szCell.x * 2;
- fs.x = (fs.x >= fMonthMaxW) ? fs.x : fMonthMaxW;
- CFX_WideString wsToday;
- GetTodayText(m_iYear, m_iMonth, m_iDay, wsToday);
- wsText = static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, FWL_MCCAPACITY_Today));
- m_wsToday = *wsText + wsToday;
- m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider);
- m_szToday.y = (m_szToday.y >= m_szCell.y) ? m_szToday.y : m_szCell.y;
- fs.y = m_szCell.x + m_szCell.y * (MONTHCAL_ROWS - 2) + m_szToday.y +
- MONTHCAL_VMARGIN * MONTHCAL_ROWS * 2 +
- MONTHCAL_HEADER_BTN_VMARGIN * 4;
- } else {
+ return CFX_SizeF();
+
+ if (!bAutoSize) {
GetClientRect(m_rtClient);
- fs.Set(m_rtClient.width, m_rtClient.height);
+ return CFX_SizeF(m_rtClient.width, m_rtClient.height);
+ }
+
+ CFX_SizeF fs;
+ CFWL_ThemePart params;
+ params.m_pWidget = m_pInterface;
+ IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
+ CFX_WideString* wsText = NULL;
+ FX_FLOAT fMaxWeekW = 0.0f;
+ FX_FLOAT fMaxWeekH = 0.0f;
+ for (FX_DWORD week = FWL_MCCAPACITY_Sun; week <= FWL_MCCAPACITY_Sat; week++) {
+ wsText = static_cast<CFX_WideString*>(pTheme->GetCapacity(&params, week));
+ CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider);
+ fMaxWeekW = (fMaxWeekW >= sz.x) ? fMaxWeekW : sz.x;
+ fMaxWeekH = (fMaxWeekH >= sz.y) ? fMaxWeekH : sz.y;
}
+ FX_FLOAT fDayMaxW = 0.0f;
+ FX_FLOAT fDayMaxH = 0.0f;
+ for (int day = 10; day <= 31; day++) {
+ CFX_WideString wsDay;
+ wsDay.Format(L"%d", day);
+ CFX_SizeF sz = CalcTextSize(wsDay, m_pProperties->m_pThemeProvider);
+ fDayMaxW = (fDayMaxW >= sz.x) ? fDayMaxW : sz.x;
+ fDayMaxH = (fDayMaxH >= sz.y) ? fDayMaxH : sz.y;
+ }
+ m_szCell.x = FX_FLOAT((fMaxWeekW >= fDayMaxW) ? (int)(fMaxWeekW + 0.5)
+ : (int)(fDayMaxW + 0.5));
+ m_szCell.y = (fMaxWeekH >= fDayMaxH) ? fMaxWeekH : fDayMaxH;
+ fs.x = m_szCell.x * MONTHCAL_COLUMNS +
+ MONTHCAL_HMARGIN * MONTHCAL_COLUMNS * 2 +
+ MONTHCAL_HEADER_BTN_HMARGIN * 2;
+ FX_FLOAT fMonthMaxW = 0.0f;
+ FX_FLOAT fMonthMaxH = 0.0f;
+ for (FX_DWORD month = FWL_MCCAPACITY_January;
+ month <= FWL_MCCAPACITY_December; month++) {
+ wsText = static_cast<CFX_WideString*>(pTheme->GetCapacity(&params, month));
+ CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider);
+ fMonthMaxW = (fMonthMaxW >= sz.x) ? fMonthMaxW : sz.x;
+ fMonthMaxH = (fMonthMaxH >= sz.y) ? fMonthMaxH : sz.y;
+ }
+ CFX_WideString wsYear;
+ GetHeadText(m_iYear, m_iMonth, wsYear);
+ CFX_SizeF szYear = CalcTextSize(wsYear, m_pProperties->m_pThemeProvider);
+ fMonthMaxH = std::max(fMonthMaxH, szYear.y);
+ m_szHead = CFX_SizeF(fMonthMaxW + szYear.x, fMonthMaxH);
+ fMonthMaxW = m_szHead.x + MONTHCAL_HEADER_BTN_HMARGIN * 2 + m_szCell.x * 2;
+ fs.x = std::max(fs.x, fMonthMaxW);
+ CFX_WideString wsToday;
+ GetTodayText(m_iYear, m_iMonth, m_iDay, wsToday);
+ wsText = static_cast<CFX_WideString*>(
+ pTheme->GetCapacity(&params, FWL_MCCAPACITY_Today));
+ m_wsToday = *wsText + wsToday;
+ m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider);
+ m_szToday.y = (m_szToday.y >= m_szCell.y) ? m_szToday.y : m_szCell.y;
+ fs.y = m_szCell.x + m_szCell.y * (MONTHCAL_ROWS - 2) + m_szToday.y +
+ MONTHCAL_VMARGIN * MONTHCAL_ROWS * 2 + MONTHCAL_HEADER_BTN_VMARGIN * 4;
return fs;
}
+
void CFWL_MonthCalendarImp::CalcHeadSize() {
FX_FLOAT fHeadHMargin = (m_rtClient.width - m_szHead.x) / 2;
FX_FLOAT fHeadVMargin = (m_szCell.x - m_szHead.y) / 2;
diff --git a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp
index e04445acad..ba349af8ba 100644
--- a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp
@@ -122,9 +122,9 @@ void CFWL_PictureBoxImp::DrawBkground(CFX_Graphics* pGraphics,
if (fy > m_rtClient.height) {
fy = m_rtClient.height;
}
- CFX_PointF pt;
- pt.Set((m_rtClient.width - fx) / 2, (m_rtClient.height - fy) / 2);
- pGraphics->DrawImage(pPicture, pt, &matrix);
+ pGraphics->DrawImage(pPicture, CFX_PointF((m_rtClient.width - fx) / 2,
+ (m_rtClient.height - fy) / 2),
+ &matrix);
}
FX_BOOL CFWL_PictureBoxImp::VStyle(FX_BOOL dwStyle) {
switch (dwStyle & FWL_STYLEEXT_PTB_VAlignMask) {
diff --git a/xfa/src/fwl/src/core/fwl_formimp.cpp b/xfa/src/fwl/src/core/fwl_formimp.cpp
index b111cbbe28..8622f2081c 100644
--- a/xfa/src/fwl/src/core/fwl_formimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_formimp.cpp
@@ -83,15 +83,10 @@ CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties,
m_rtRestore.Reset();
m_rtCaptionText.Reset();
m_rtIcon.Reset();
- m_InfoStart.m_ptStart.Reset();
- m_InfoStart.m_szStart.Reset();
}
CFWL_FormImp::~CFWL_FormImp() {
RemoveSysButtons();
- if (m_pNoteLoop) {
- delete m_pNoteLoop;
- m_pNoteLoop = NULL;
- }
+ delete m_pNoteLoop;
}
FWL_ERR CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_Form;
@@ -1036,10 +1031,10 @@ void CFWL_FormImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
!m_pOwner->m_bMaximized) {
m_pOwner->SetCursor(pMsg->m_fx, pMsg->m_fy);
}
- m_pOwner->m_InfoStart.m_ptStart.Set(pMsg->m_fx, pMsg->m_fy);
- m_pOwner->m_InfoStart.m_szStart.Set(
- m_pOwner->m_pProperties->m_rtWidget.width,
- m_pOwner->m_pProperties->m_rtWidget.height);
+ m_pOwner->m_InfoStart.m_ptStart = CFX_PointF(pMsg->m_fx, pMsg->m_fy);
+ m_pOwner->m_InfoStart.m_szStart =
+ CFX_SizeF(m_pOwner->m_pProperties->m_rtWidget.width,
+ m_pOwner->m_pProperties->m_rtWidget.height);
}
void CFWL_FormImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_pOwner->SetGrab(FALSE);
diff --git a/xfa/src/fwl/src/core/fwl_noteimp.cpp b/xfa/src/fwl/src/core/fwl_noteimp.cpp
index 9bdb04f1a5..8de329a5cc 100644
--- a/xfa/src/fwl/src/core/fwl_noteimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_noteimp.cpp
@@ -839,9 +839,7 @@ CFX_DIBitmap* CFWL_CoreToopTipDP::GetToolTipIcon(IFWL_Widget* pWidget) {
return NULL;
}
CFX_SizeF CFWL_CoreToopTipDP::GetToolTipIconSize(IFWL_Widget* pWidget) {
- CFX_SizeF sz;
- sz.Set(0, 0);
- return sz;
+ return CFX_SizeF();
}
CFX_RectF CFWL_CoreToopTipDP::GetAnchor() {
return m_fAnchor;
@@ -1007,9 +1005,7 @@ FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt,
m_ToolTipDp->m_wsCaption = wsCaption;
}
CFX_RectF rt;
- rt.Reset();
CFX_SizeF sz;
- sz.Reset();
pCurTarget->GetToolTipSize(sz);
if (sz.x > 0 && sz.y > 0) {
rt.width = sz.x;
@@ -1020,8 +1016,7 @@ FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt,
rt.width = r.width;
rt.height = r.height;
}
- CFX_PointF pt;
- pt.Set(pEvt->m_fx, pEvt->m_fy);
+ CFX_PointF pt(pEvt->m_fx, pEvt->m_fy);
if (pCurTarget->GetToolTipPos(pt) == FWL_ERR_Succeeded) {
rt.left = pt.x;
rt.top = pt.y;
diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
index eb180a19e0..a4678c2c70 100644
--- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
@@ -652,10 +652,9 @@ CFX_SizeF CFWL_WidgetImp::CalcTextSize(const CFX_WideString& wsText,
IFWL_ThemeProvider* pTheme,
FX_BOOL bMultiLine,
int32_t iLineWidth) {
- CFX_SizeF sz;
- sz.Set(0, 0);
if (!pTheme)
- return sz;
+ return CFX_SizeF();
+
CFWL_ThemeText calPart;
calPart.m_pWidget = m_pInterface;
calPart.m_wsText = wsText;
@@ -669,9 +668,7 @@ CFX_SizeF CFWL_WidgetImp::CalcTextSize(const CFX_WideString& wsText,
: FWL_WGT_CalcWidth;
rect.Set(0, 0, fWidth, FWL_WGT_CalcHeight);
pTheme->CalcTextRect(&calPart, rect);
- sz.x = rect.width;
- sz.y = rect.height;
- return sz;
+ return CFX_SizeF(rect.width, rect.height);
}
void CFWL_WidgetImp::CalcTextRect(const CFX_WideString& wsText,
IFWL_ThemeProvider* pTheme,
@@ -930,22 +927,21 @@ void CFWL_WidgetImp::NotifyDriver() {
pDriver->NotifyTargetDestroy(m_pInterface);
}
CFX_SizeF CFWL_WidgetImp::GetOffsetFromParent(IFWL_Widget* pParent) {
- CFX_SizeF szRet;
- szRet.Set(0, 0);
- if (pParent == GetInterface()) {
- return szRet;
- }
+ if (pParent == GetInterface())
+ return CFX_SizeF();
+
IFWL_WidgetMgr* pWidgetMgr = FWL_GetWidgetMgr();
if (!pWidgetMgr)
- return szRet;
- szRet.x += m_pProperties->m_rtWidget.left;
- szRet.y += m_pProperties->m_rtWidget.top;
+ return CFX_SizeF();
+
+ CFX_SizeF szRet(m_pProperties->m_rtWidget.left,
+ m_pProperties->m_rtWidget.top);
+
IFWL_Widget* pDstWidget = GetParent();
while (pDstWidget && pDstWidget != pParent) {
CFX_RectF rtDst;
pDstWidget->GetWidgetRect(rtDst);
- szRet.x += rtDst.left;
- szRet.y += rtDst.top;
+ szRet += CFX_SizeF(rtDst.left, rtDst.top);
pDstWidget = pWidgetMgr->GetWidget(pDstWidget, FWL_WGTRELATION_Parent);
}
return szRet;
diff --git a/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp b/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
index 9891a3b04a..d3ce414e00 100644
--- a/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
+++ b/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
@@ -86,7 +86,6 @@ CFWL_ToolTip::CFWL_ToolTipDP::CFWL_ToolTipDP() : m_pBitmap(NULL) {
m_wsCaption = L"";
m_nInitDelayTime = 500;
m_nAutoPopDelayTime = 50000;
- m_fIconSize.Set(0.0, 0.0);
m_fAnchor.Set(0.0, 0.0, 0.0, 0.0);
}
FWL_ERR CFWL_ToolTip::CFWL_ToolTipDP::GetCaption(IFWL_Widget* pWidget,
diff --git a/xfa/src/fwl/src/lightwidget/widget.cpp b/xfa/src/fwl/src/lightwidget/widget.cpp
index 896ff80be3..6c65798eaf 100644
--- a/xfa/src/fwl/src/lightwidget/widget.cpp
+++ b/xfa/src/fwl/src/lightwidget/widget.cpp
@@ -283,13 +283,12 @@ void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
FX_BOOL bMultiLine,
int32_t iLineWidth) {
- CFX_SizeF sz;
- sz.Set(0, 0);
if (!m_pIface)
- return sz;
+ return CFX_SizeF();
IFWL_ThemeProvider* pTheme = m_pIface->GetThemeProvider();
if (!pTheme)
- return sz;
+ return CFX_SizeF();
+
CFWL_ThemeText calPart;
calPart.m_pWidget = m_pIface;
calPart.m_wsText = wsText;
@@ -303,9 +302,7 @@ CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
: FWL_WGT_CalcWidth;
rect.Set(0, 0, fWidth, FWL_WGT_CalcHeight);
pTheme->CalcTextRect(&calPart, rect);
- sz.x = rect.width;
- sz.y = rect.height;
- return sz;
+ return CFX_SizeF(rect.width, rect.height);
}
CFWL_WidgetDelegate::CFWL_WidgetDelegate() {}
CFWL_WidgetDelegate::~CFWL_WidgetDelegate() {}
diff --git a/xfa/src/fwl/src/theme/checkboxtp.cpp b/xfa/src/fwl/src/theme/checkboxtp.cpp
index 3cc6f43622..69a996bbe0 100644
--- a/xfa/src/fwl/src/theme/checkboxtp.cpp
+++ b/xfa/src/fwl/src/theme/checkboxtp.cpp
@@ -334,9 +334,8 @@ void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics* pGraphics,
FX_FLOAT fBottom = pRtSign->bottom();
FX_FLOAT fRadius =
(pRtSign->top - fBottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f));
- CFX_PointF ptCenter;
- ptCenter.Set((pRtSign->left + pRtSign->right()) / 2.0f,
- (pRtSign->top + fBottom) / 2.0f);
+ CFX_PointF ptCenter((pRtSign->left + pRtSign->right()) / 2.0f,
+ (pRtSign->top + fBottom) / 2.0f);
FX_FLOAT px[5], py[5];
FX_FLOAT fAngel = FX_PI / 10.0f;
for (int32_t i = 0; i < 5; i++) {
@@ -466,42 +465,28 @@ void CFWL_CheckBoxTP::initCheckPath(FX_FLOAT fCheckLen) {
FX_FLOAT fWidth = CHECKBOX_SIZE_SIGNPATH;
FX_FLOAT fHeight = -CHECKBOX_SIZE_SIGNPATH;
FX_FLOAT fBottom = CHECKBOX_SIZE_SIGNPATH;
- FX_FLOAT px1, py1, px2, py2;
- CFX_PointF pt1;
- pt1.Set(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f);
- CFX_PointF pt2;
- pt2.Set(fWidth / 4.5f, fBottom + fHeight / 16.0f);
- CFX_PointF pt3;
- pt3.Set(fWidth / 3.0f, fBottom);
- CFX_PointF pt4;
- pt4.Set(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f);
- CFX_PointF pt5;
- pt5.Set(fWidth / 3.6f, fBottom + fHeight / 3.5f);
- CFX_PointF pt12;
- pt12.Set(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f);
- CFX_PointF pt21;
- pt21.Set(fWidth / 5.0f, fBottom + fHeight / 5.0f);
- CFX_PointF pt23;
- pt23.Set(fWidth / 4.4f, fBottom + fHeight * 0 / 16.0f);
- CFX_PointF pt32;
- pt32.Set(fWidth / 4.0f, fBottom);
- CFX_PointF pt34;
- pt34.Set(fWidth * (1 / 7.0f + 7 / 15.0f), fBottom + fHeight * 4 / 5.0f);
- CFX_PointF pt43;
- pt43.Set(fWidth * (1 / 7.0f + 7 / 15.0f), fBottom + fHeight * 4 / 5.0f);
- CFX_PointF pt45;
- pt45.Set(fWidth * 7 / 15.0f, fBottom + fHeight * 8 / 7.0f);
- CFX_PointF pt54;
- pt54.Set(fWidth / 3.4f, fBottom + fHeight / 3.5f);
- CFX_PointF pt51;
- pt51.Set(fWidth / 3.6f, fBottom + fHeight / 4.0f);
- CFX_PointF pt15;
- pt15.Set(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f);
+ CFX_PointF pt1(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f);
+ CFX_PointF pt2(fWidth / 4.5f, fBottom + fHeight / 16.0f);
+ CFX_PointF pt3(fWidth / 3.0f, fBottom);
+ CFX_PointF pt4(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f);
+ CFX_PointF pt5(fWidth / 3.6f, fBottom + fHeight / 3.5f);
+ CFX_PointF pt12(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f);
+ CFX_PointF pt21(fWidth / 5.0f, fBottom + fHeight / 5.0f);
+ CFX_PointF pt23(fWidth / 4.4f, fBottom + fHeight * 0 / 16.0f);
+ CFX_PointF pt32(fWidth / 4.0f, fBottom);
+ CFX_PointF pt34(fWidth * (1 / 7.0f + 7 / 15.0f),
+ fBottom + fHeight * 4 / 5.0f);
+ CFX_PointF pt43(fWidth * (1 / 7.0f + 7 / 15.0f),
+ fBottom + fHeight * 4 / 5.0f);
+ CFX_PointF pt45(fWidth * 7 / 15.0f, fBottom + fHeight * 8 / 7.0f);
+ CFX_PointF pt54(fWidth / 3.4f, fBottom + fHeight / 3.5f);
+ CFX_PointF pt51(fWidth / 3.6f, fBottom + fHeight / 4.0f);
+ CFX_PointF pt15(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f);
m_pCheckPath->MoveTo(pt1.x, pt1.y);
- px1 = pt12.x - pt1.x;
- py1 = pt12.y - pt1.y;
- px2 = pt21.x - pt2.x;
- py2 = pt21.y - pt2.y;
+ FX_FLOAT px1 = pt12.x - pt1.x;
+ FX_FLOAT py1 = pt12.y - pt1.y;
+ FX_FLOAT px2 = pt21.x - pt2.x;
+ FX_FLOAT py2 = pt21.y - pt2.y;
m_pCheckPath->BezierTo(pt1.x + px1 * FWLTHEME_BEZIER,
pt1.y + py1 * FWLTHEME_BEZIER,
pt2.x + px2 * FWLTHEME_BEZIER,
diff --git a/xfa/src/fwl/src/theme/widgettp.cpp b/xfa/src/fwl/src/theme/widgettp.cpp
index 10ed696aa0..89195a501c 100644
--- a/xfa/src/fwl/src/theme/widgettp.cpp
+++ b/xfa/src/fwl/src/theme/widgettp.cpp
@@ -446,13 +446,11 @@ void CFWL_WidgetTP::DrawAxialShading(CFX_Graphics* pGraphics,
CFX_Path* path,
int32_t fillMode,
CFX_Matrix* pMatrix) {
- if (!pGraphics)
- return;
- if (!path)
+ if (!pGraphics || !path)
return;
- CFX_PointF begPoint, endPoint;
- begPoint.Set(fx1, fy1);
- endPoint.Set(fx2, fy2);
+
+ CFX_PointF begPoint(fx1, fy1);
+ CFX_PointF endPoint(fx2, fy2);
CFX_Shading shading;
shading.CreateAxial(begPoint, endPoint, FALSE, FALSE, beginColor, endColor);
pGraphics->SaveGraphState();