Pass CFWL_Theme{Background,Text,Part} params by const-ref.
They are always present and never modified by callers. In
turn, remove some nullness checks and add more "consts".
Change-Id: Ibe9a2b8191e1d45bca88c78b25f220aa43eac349
Reviewed-on: https://pdfium-review.googlesource.com/c/48430
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp
index edd3512..f59b441 100644
--- a/xfa/fwl/cfwl_barcode.cpp
+++ b/xfa/fwl/cfwl_barcode.cpp
@@ -163,12 +163,12 @@
if (pTheme) {
CFWL_ThemePart part;
part.m_pWidget = this;
- if (RetainPtr<CFGAS_GEFont> pFont = pTheme->GetFont(&part)) {
+ if (RetainPtr<CFGAS_GEFont> pFont = pTheme->GetFont(part)) {
if (CFX_Font* pCXFont = pFont->GetDevFont())
m_pBarcodeEngine->SetFont(pCXFont);
}
- m_pBarcodeEngine->SetFontSize(pTheme->GetFontSize(&part));
- m_pBarcodeEngine->SetFontColor(pTheme->GetTextColor(&part));
+ m_pBarcodeEngine->SetFontSize(pTheme->GetFontSize(part));
+ m_pBarcodeEngine->SetFontColor(pTheme->GetTextColor(part));
} else {
m_pBarcodeEngine->SetFontSize(FWLTHEME_CAPACITY_FontSize);
}
diff --git a/xfa/fwl/cfwl_caret.cpp b/xfa/fwl/cfwl_caret.cpp
index b2efba4..9380f9e 100644
--- a/xfa/fwl/cfwl_caret.cpp
+++ b/xfa/fwl/cfwl_caret.cpp
@@ -91,7 +91,7 @@
param.m_dwStates = CFWL_PartState_HightLight;
if (pMatrix)
param.m_matrix.Concat(*pMatrix);
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
void CFWL_Caret::OnProcessMessage(CFWL_Message* pMessage) {}
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index 35445a9..d627043 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -76,12 +76,13 @@
param.m_matrix.Concat(matrix);
param.m_rtPart = m_rtClient;
if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused)
+
param.m_pRtData = &m_rtFocus;
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
param.m_iPart = CFWL_Part::CheckBox;
param.m_rtPart = m_rtBox;
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
CFWL_ThemeText textParam;
textParam.m_pWidget = this;
@@ -93,7 +94,7 @@
textParam.m_wsText = L"Check box";
textParam.m_dwTTOStyles = m_TTOStyles;
textParam.m_iTTOAlign = m_iTTOAlign;
- pTheme->DrawText(&textParam);
+ pTheme->DrawText(textParam);
}
void CFWL_CheckBox::SetCheckState(int32_t iCheck) {
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index a835528..84f1be3 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -108,7 +108,7 @@
param.m_dwStates = m_iBtnState;
param.m_pGraphics = pGraphics;
param.m_rtPart = m_rtBtn;
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
pGraphics->RestoreGraphState();
@@ -222,7 +222,7 @@
param.m_pWidget = this;
if (pMatrix)
param.m_matrix.Concat(*pMatrix);
- m_pProperties->m_pThemeProvider->DrawBackground(¶m);
+ m_pProperties->m_pThemeProvider->DrawBackground(param);
}
void CFWL_ComboBox::ShowDropList(bool bActivate) {
@@ -305,7 +305,7 @@
CFWL_ThemePart part;
part.m_pWidget = this;
- CFX_RectF pUIMargin = theme->GetUIMargin(&part);
+ CFX_RectF pUIMargin = theme->GetUIMargin(part);
m_rtContent.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
pUIMargin.height);
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index 51727f1..a3fbc9c 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -211,7 +211,7 @@
param.m_rtPart = m_rtBtn;
if (pMatrix)
param.m_matrix.Concat(*pMatrix);
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
WideString CFWL_DateTimePicker::FormatDateString(int32_t iYear,
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 0c28a18..c5aac8a 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -342,7 +342,7 @@
param.m_pGraphics = pGraphics;
param.m_matrix = *pMatrix;
param.m_rtPart = m_rtClient;
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
if (!IsShowScrollBar(true) || !IsShowScrollBar(false))
return;
@@ -355,7 +355,7 @@
param.m_bStaticBackground = true;
param.m_bMaximize = true;
param.m_rtPart = rtStatic;
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
void CFWL_Edit::DrawContent(CXFA_Graphics* pGraphics,
@@ -398,7 +398,7 @@
param.m_pWidget = this;
param.m_iPart = CFWL_Part::Background;
param.m_pPath = &path;
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
CFX_RenderDevice* pRenderDev = pGraphics->GetRenderDevice();
@@ -426,7 +426,7 @@
param.m_pWidget = this;
param.m_iPart = CFWL_Part::CombTextLine;
param.m_pPath = &path;
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
pGraphics->RestoreGraphState();
}
@@ -530,19 +530,19 @@
m_fFontSize = FWLTHEME_CAPACITY_FontSize;
return;
}
- m_fFontSize = theme->GetFontSize(&part);
+ m_fFontSize = theme->GetFontSize(part);
- RetainPtr<CFGAS_GEFont> pFont = theme->GetFont(&part);
+ RetainPtr<CFGAS_GEFont> pFont = theme->GetFont(part);
if (!pFont)
return;
m_EdtEngine.SetFont(pFont);
- m_EdtEngine.SetFontColor(theme->GetTextColor(&part));
+ m_EdtEngine.SetFontColor(theme->GetTextColor(part));
m_EdtEngine.SetFontSize(m_fFontSize);
- m_EdtEngine.SetLineSpace(theme->GetLineHeight(&part));
+ m_EdtEngine.SetLineSpace(theme->GetLineHeight(part));
m_EdtEngine.SetTabWidth(m_fFontSize);
m_EdtEngine.SetVisibleLineCount(m_rtEngine.height /
- theme->GetLineHeight(&part));
+ theme->GetLineHeight(part));
}
void CFWL_Edit::UpdateEditLayout() {
@@ -607,7 +607,7 @@
CFWL_ThemePart part;
part.m_pWidget = this;
- CFX_SizeF pSpace = theme->GetSpaceAboveBelow(&part);
+ CFX_SizeF pSpace = theme->GetSpaceAboveBelow(part);
fSpaceAbove = pSpace.width >= 0.1f ? pSpace.width : 0.0f;
fSpaceBelow = pSpace.height >= 0.1f ? pSpace.height : 0.0f;
}
@@ -741,12 +741,12 @@
CFWL_ThemePart part;
if (!m_pOuter) {
part.m_pWidget = this;
- CFX_RectF pUIMargin = theme->GetUIMargin(&part);
+ CFX_RectF pUIMargin = theme->GetUIMargin(part);
m_rtEngine.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
pUIMargin.height);
} else if (m_pOuter->GetClassID() == FWL_Type::DateTimePicker) {
part.m_pWidget = m_pOuter;
- CFX_RectF pUIMargin = theme->GetUIMargin(&part);
+ CFX_RectF pUIMargin = theme->GetUIMargin(part);
m_rtEngine.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
pUIMargin.height);
}
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index 9e718fe..9d84649 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -361,7 +361,7 @@
if (!IsEnabled())
param.m_dwStates = CFWL_PartState_Disabled;
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
void CFWL_ListBox::DrawItems(CXFA_Graphics* pGraphics,
@@ -431,7 +431,7 @@
bg_param.m_rtPart.width -= (m_fScorllBarWidth + 1);
rtFocus.Deflate(0.5, 0.5, 1 + m_fScorllBarWidth, 1);
}
- pTheme->DrawBackground(&bg_param);
+ pTheme->DrawBackground(bg_param);
if (!pItem)
return;
@@ -454,7 +454,7 @@
textParam.m_dwTTOStyles = m_TTOStyles;
textParam.m_iTTOAlign = m_iTTOAligns;
textParam.m_bMaximize = true;
- pTheme->DrawText(&textParam);
+ pTheme->DrawText(textParam);
}
CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) {
@@ -468,7 +468,7 @@
CFWL_ThemePart part;
part.m_pWidget = this;
IFWL_ThemeProvider* theme = GetAvailableTheme();
- CFX_RectF pUIMargin = theme ? theme->GetUIMargin(&part) : CFX_RectF();
+ CFX_RectF pUIMargin = theme ? theme->GetUIMargin(part) : CFX_RectF();
m_rtConent.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
pUIMargin.height);
}
@@ -607,7 +607,7 @@
IFWL_ThemeProvider* theme = GetAvailableTheme();
CFWL_ThemePart part;
part.m_pWidget = this;
- return (theme ? theme->GetFontSize(&part) : 20.0f) + 2 * kItemTextMargin;
+ return (theme ? theme->GetFontSize(part) : 20.0f) + 2 * kItemTextMargin;
}
void CFWL_ListBox::InitVerticalScrollBar() {
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp
index dc8328b..548b27f 100644
--- a/xfa/fwl/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -162,7 +162,7 @@
params.m_rtPart = m_rtClient;
if (pMatrix)
params.m_matrix.Concat(*pMatrix);
- pTheme->DrawBackground(¶ms);
+ pTheme->DrawBackground(params);
}
void CFWL_MonthCalendar::DrawHeadBK(CXFA_Graphics* pGraphics,
@@ -176,7 +176,7 @@
params.m_rtPart = m_rtHead;
if (pMatrix)
params.m_matrix.Concat(*pMatrix);
- pTheme->DrawBackground(¶ms);
+ pTheme->DrawBackground(params);
}
void CFWL_MonthCalendar::DrawLButton(CXFA_Graphics* pGraphics,
@@ -190,7 +190,7 @@
params.m_rtPart = m_rtLBtn;
if (pMatrix)
params.m_matrix.Concat(*pMatrix);
- pTheme->DrawBackground(¶ms);
+ pTheme->DrawBackground(params);
}
void CFWL_MonthCalendar::DrawRButton(CXFA_Graphics* pGraphics,
@@ -204,7 +204,7 @@
params.m_rtPart = m_rtRBtn;
if (pMatrix)
params.m_matrix.Concat(*pMatrix);
- pTheme->DrawBackground(¶ms);
+ pTheme->DrawBackground(params);
}
void CFWL_MonthCalendar::DrawCaption(CXFA_Graphics* pGraphics,
@@ -224,7 +224,7 @@
textParam.m_iTTOAlign = FDE_TextAlignment::kCenter;
if (pMatrix)
textParam.m_matrix.Concat(*pMatrix);
- pTheme->DrawText(&textParam);
+ pTheme->DrawText(textParam);
}
void CFWL_MonthCalendar::DrawSeperator(CXFA_Graphics* pGraphics,
@@ -238,7 +238,7 @@
params.m_rtPart = m_rtHSep;
if (pMatrix)
params.m_matrix.Concat(*pMatrix);
- pTheme->DrawBackground(¶ms);
+ pTheme->DrawBackground(params);
}
void CFWL_MonthCalendar::DrawDatesInBK(CXFA_Graphics* pGraphics,
@@ -263,10 +263,10 @@
params.m_dwStates |= CFWL_PartState_Hovered;
} else if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Flag) {
params.m_dwStates = CFWL_PartState_Flagged;
- pTheme->DrawBackground(¶ms);
+ pTheme->DrawBackground(params);
}
params.m_rtPart = pDataInfo->rect;
- pTheme->DrawBackground(¶ms);
+ pTheme->DrawBackground(params);
params.m_dwStates = 0;
}
}
@@ -293,7 +293,7 @@
params.m_rtPart = rtDayOfWeek;
params.m_wsText = GetCapacityForDay(pTheme, params, i);
- pTheme->DrawText(¶ms);
+ pTheme->DrawText(params);
}
}
@@ -316,7 +316,7 @@
if (pMatrix)
params.m_matrix.Concat(*pMatrix);
- pTheme->DrawText(¶ms);
+ pTheme->DrawText(params);
}
void CFWL_MonthCalendar::DrawDatesIn(CXFA_Graphics* pGraphics,
@@ -341,7 +341,7 @@
params.m_dwStates |= CFWL_PartState_Hovered;
params.m_dwTTOStyles.single_line_ = true;
- pTheme->DrawText(¶ms);
+ pTheme->DrawText(params);
}
}
@@ -356,7 +356,7 @@
params.m_iTTOAlign = FDE_TextAlignment::kCenter;
if (pMatrix)
params.m_matrix.Concat(*pMatrix);
- pTheme->DrawText(¶ms);
+ pTheme->DrawText(params);
}
void CFWL_MonthCalendar::DrawDatesInCircle(CXFA_Graphics* pGraphics,
@@ -380,7 +380,7 @@
params.m_dwStates = CFWL_PartState_Normal;
if (pMatrix)
params.m_matrix.Concat(*pMatrix);
- pTheme->DrawBackground(¶ms);
+ pTheme->DrawBackground(params);
}
CFX_SizeF CFWL_MonthCalendar::CalcSize() {
diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp
index a977a7b..4737f9e 100644
--- a/xfa/fwl/cfwl_pushbutton.cpp
+++ b/xfa/fwl/cfwl_pushbutton.cpp
@@ -75,7 +75,7 @@
param.m_rtPart = m_rtClient;
if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused)
param.m_pRtData = &m_rtCaption;
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
uint32_t CFWL_PushButton::GetPartStates() {
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp
index 9a762a5..9c9eec1 100644
--- a/xfa/fwl/cfwl_scrollbar.cpp
+++ b/xfa/fwl/cfwl_scrollbar.cpp
@@ -93,7 +93,7 @@
param.m_pGraphics = pGraphics;
param.m_matrix.Concat(*pMatrix);
param.m_rtPart = bLower ? m_rtMinTrack : m_rtMaxTrack;
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
void CFWL_ScrollBar::DrawArrowBtn(CXFA_Graphics* pGraphics,
@@ -110,7 +110,7 @@
param.m_matrix.Concat(*pMatrix);
param.m_rtPart = bMinBtn ? m_rtMinBtn : m_rtMaxBtn;
if (param.m_rtPart.height > 0 && param.m_rtPart.width > 0)
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
void CFWL_ScrollBar::DrawThumb(CXFA_Graphics* pGraphics,
@@ -125,7 +125,7 @@
param.m_pGraphics = pGraphics;
param.m_matrix.Concat(*pMatrix);
param.m_rtPart = m_rtThumb;
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
void CFWL_ScrollBar::Layout() {
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index 1fb0855..027dfc4 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -274,7 +274,7 @@
calPart.m_iTTOAlign = FDE_TextAlignment::kTopLeft;
float fWidth = bMultiLine ? FWL_WGT_CalcMultiLineDefWidth : FWL_WGT_CalcWidth;
CFX_RectF rect(0, 0, fWidth, FWL_WGT_CalcHeight);
- pTheme->CalcTextRect(&calPart, &rect);
+ pTheme->CalcTextRect(calPart, &rect);
return CFX_SizeF(rect.width, rect.height);
}
@@ -288,7 +288,7 @@
calPart.m_wsText = wsText;
calPart.m_dwTTOStyles = dwTTOStyles;
calPart.m_iTTOAlign = iTTOAlign;
- pTheme->CalcTextRect(&calPart, pRect);
+ pTheme->CalcTextRect(calPart, pRect);
}
void CFWL_Widget::SetGrab(bool bSet) {
@@ -330,7 +330,7 @@
if (pMatrix)
param.m_matrix = *pMatrix;
param.m_rtPart = GetRelativeRect();
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
void CFWL_Widget::DrawBorder(CXFA_Graphics* pGraphics,
@@ -343,7 +343,7 @@
param.m_pGraphics = pGraphics;
param.m_matrix = matrix;
param.m_rtPart = GetRelativeRect();
- pTheme->DrawBackground(¶m);
+ pTheme->DrawBackground(param);
}
void CFWL_Widget::NotifyDriver() {
diff --git a/xfa/fwl/ifwl_themeprovider.h b/xfa/fwl/ifwl_themeprovider.h
index 1996768..5700d34 100644
--- a/xfa/fwl/ifwl_themeprovider.h
+++ b/xfa/fwl/ifwl_themeprovider.h
@@ -21,18 +21,21 @@
public:
virtual ~IFWL_ThemeProvider() = default;
- virtual void DrawBackground(CFWL_ThemeBackground* pParams) = 0;
- virtual void DrawText(CFWL_ThemeText* pParams) = 0;
- virtual void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF* pRect) = 0;
+ virtual void DrawBackground(const CFWL_ThemeBackground& pParams) = 0;
+ virtual void DrawText(const CFWL_ThemeText& pParams) = 0;
+ virtual void CalcTextRect(const CFWL_ThemeText& pParams,
+ CFX_RectF* pRect) = 0;
virtual float GetCXBorderSize() const = 0;
virtual float GetCYBorderSize() const = 0;
- virtual CFX_RectF GetUIMargin(CFWL_ThemePart* pThemePart) const = 0;
- virtual float GetFontSize(CFWL_ThemePart* pThemePart) const = 0;
- virtual RetainPtr<CFGAS_GEFont> GetFont(CFWL_ThemePart* pThemePart) const = 0;
- virtual float GetLineHeight(CFWL_ThemePart* pThemePart) const = 0;
+ virtual CFX_RectF GetUIMargin(const CFWL_ThemePart& pThemePart) const = 0;
+ virtual float GetFontSize(const CFWL_ThemePart& pThemePart) const = 0;
+ virtual RetainPtr<CFGAS_GEFont> GetFont(
+ const CFWL_ThemePart& pThemePart) const = 0;
+ virtual float GetLineHeight(const CFWL_ThemePart& pThemePart) const = 0;
virtual float GetScrollBarWidth() const = 0;
- virtual FX_COLORREF GetTextColor(CFWL_ThemePart* pThemePart) const = 0;
- virtual CFX_SizeF GetSpaceAboveBelow(CFWL_ThemePart* pThemePart) const = 0;
+ virtual FX_COLORREF GetTextColor(const CFWL_ThemePart& pThemePart) const = 0;
+ virtual CFX_SizeF GetSpaceAboveBelow(
+ const CFWL_ThemePart& pThemePart) const = 0;
};
#endif // XFA_FWL_IFWL_THEMEPROVIDER_H_
diff --git a/xfa/fwl/theme/cfwl_barcodetp.cpp b/xfa/fwl/theme/cfwl_barcodetp.cpp
index 52e0c9f..c1baf9b 100644
--- a/xfa/fwl/theme/cfwl_barcodetp.cpp
+++ b/xfa/fwl/theme/cfwl_barcodetp.cpp
@@ -14,18 +14,15 @@
CFWL_BarcodeTP::~CFWL_BarcodeTP() {}
-void CFWL_BarcodeTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- if (!pParams)
- return;
-
- switch (pParams->m_iPart) {
+void CFWL_BarcodeTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
+ switch (pParams.m_iPart) {
case CFWL_Part::Border:
- DrawBorder(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
- &pParams->m_matrix);
+ DrawBorder(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
+ &pParams.m_matrix);
break;
case CFWL_Part::Background:
- FillBackground(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
- &pParams->m_matrix);
+ FillBackground(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
+ &pParams.m_matrix);
break;
default:
break;
diff --git a/xfa/fwl/theme/cfwl_barcodetp.h b/xfa/fwl/theme/cfwl_barcodetp.h
index 3fb9d3d..8b88fcd 100644
--- a/xfa/fwl/theme/cfwl_barcodetp.h
+++ b/xfa/fwl/theme/cfwl_barcodetp.h
@@ -16,7 +16,7 @@
~CFWL_BarcodeTP() override;
// CFWL_WidgetTP
- void DrawBackground(CFWL_ThemeBackground* pParams) override;
+ void DrawBackground(const CFWL_ThemeBackground& pParams) override;
};
#endif // XFA_FWL_THEME_CFWL_BARCODETP_H_
diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp
index 3cc8355..4d95034 100644
--- a/xfa/fwl/theme/cfwl_carettp.cpp
+++ b/xfa/fwl/theme/cfwl_carettp.cpp
@@ -15,17 +15,14 @@
CFWL_CaretTP::CFWL_CaretTP() {}
CFWL_CaretTP::~CFWL_CaretTP() {}
-void CFWL_CaretTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- if (!pParams)
- return;
-
- switch (pParams->m_iPart) {
+void CFWL_CaretTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
+ switch (pParams.m_iPart) {
case CFWL_Part::Background: {
- if (!(pParams->m_dwStates & CFWL_PartState_HightLight))
+ if (!(pParams.m_dwStates & CFWL_PartState_HightLight))
return;
- DrawCaretBK(pParams->m_pGraphics.Get(), pParams->m_dwStates,
- &pParams->m_rtPart, &pParams->m_matrix);
+ DrawCaretBK(pParams.m_pGraphics.Get(), pParams.m_dwStates,
+ &pParams.m_rtPart, &pParams.m_matrix);
break;
}
default:
@@ -36,7 +33,7 @@
void CFWL_CaretTP::DrawCaretBK(CXFA_Graphics* pGraphics,
uint32_t dwStates,
const CFX_RectF* pRect,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
CFX_RectF rect = *pRect;
path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
diff --git a/xfa/fwl/theme/cfwl_carettp.h b/xfa/fwl/theme/cfwl_carettp.h
index 633abf0..096ed7a 100644
--- a/xfa/fwl/theme/cfwl_carettp.h
+++ b/xfa/fwl/theme/cfwl_carettp.h
@@ -15,13 +15,13 @@
~CFWL_CaretTP() override;
// CFWL_WidgetTP
- void DrawBackground(CFWL_ThemeBackground* pParams) override;
+ void DrawBackground(const CFWL_ThemeBackground& pParams) override;
private:
void DrawCaretBK(CXFA_Graphics* pGraphics,
uint32_t dwStates,
const CFX_RectF* pRect,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
};
#endif // XFA_FWL_THEME_CFWL_CARETTP_H_
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index f54f93f..c97bc91 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -48,11 +48,11 @@
CFWL_WidgetTP::Finalize();
}
-void CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) {
+void CFWL_CheckBoxTP::DrawText(const CFWL_ThemeText& pParams) {
if (!m_pTextOut)
return;
- m_pTextOut->SetTextColor(pParams->m_dwStates & CFWL_PartState_Disabled
+ m_pTextOut->SetTextColor(pParams.m_dwStates & CFWL_PartState_Disabled
? FWLTHEME_CAPACITY_TextDisColor
: FWLTHEME_CAPACITY_TextColor);
CFWL_WidgetTP::DrawText(pParams);
@@ -61,7 +61,7 @@
void CFWL_CheckBoxTP::DrawSignCheck(CXFA_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
if (!m_pCheckPath)
InitCheckPath(pRtSign->width);
@@ -77,7 +77,7 @@
void CFWL_CheckBoxTP::DrawSignCircle(CXFA_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
path.AddEllipse(*pRtSign);
pGraphics->SaveGraphState();
@@ -89,7 +89,7 @@
void CFWL_CheckBoxTP::DrawSignCross(CXFA_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
float fRight = pRtSign->right();
float fBottom = pRtSign->bottom();
@@ -107,7 +107,7 @@
void CFWL_CheckBoxTP::DrawSignDiamond(CXFA_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
float fWidth = pRtSign->width;
float fHeight = pRtSign->height;
@@ -127,7 +127,7 @@
void CFWL_CheckBoxTP::DrawSignSquare(CXFA_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
path.AddRectangle(pRtSign->left, pRtSign->top, pRtSign->width,
pRtSign->height);
@@ -140,7 +140,7 @@
void CFWL_CheckBoxTP::DrawSignStar(CXFA_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
float fBottom = pRtSign->bottom();
float fRadius =
@@ -264,14 +264,14 @@
}
}
-void CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- if (pParams->m_iPart != CFWL_Part::CheckBox)
+void CFWL_CheckBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
+ if (pParams.m_iPart != CFWL_Part::CheckBox)
return;
- if ((pParams->m_dwStates & CFWL_PartState_Checked) ||
- (pParams->m_dwStates & CFWL_PartState_Neutral)) {
- DrawCheckSign(pParams->m_pWidget, pParams->m_pGraphics.Get(),
- pParams->m_rtPart, pParams->m_dwStates, &pParams->m_matrix);
+ if ((pParams.m_dwStates & CFWL_PartState_Checked) ||
+ (pParams.m_dwStates & CFWL_PartState_Neutral)) {
+ DrawCheckSign(pParams.m_pWidget, pParams.m_pGraphics.Get(),
+ pParams.m_rtPart, pParams.m_dwStates, &pParams.m_matrix);
}
}
@@ -279,7 +279,7 @@
CXFA_Graphics* pGraphics,
const CFX_RectF& pRtBox,
int32_t iState,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
CFX_RectF rtSign(pRtBox);
uint32_t dwColor = iState & CFWL_PartState_Neutral ? 0xFFA9A9A9 : 0xFF000000;
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h
index 3898648..f10f4be 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.h
+++ b/xfa/fwl/theme/cfwl_checkboxtp.h
@@ -19,11 +19,11 @@
CFWL_CheckBoxTP();
~CFWL_CheckBoxTP() override;
- // CFWL_WidgeTP
+ // CFWL_WidgetTP
void Initialize() override;
void Finalize() override;
- void DrawText(CFWL_ThemeText* pParams) override;
- void DrawBackground(CFWL_ThemeBackground* pParams) override;
+ void DrawBackground(const CFWL_ThemeBackground& pParams) override;
+ void DrawText(const CFWL_ThemeText& pParams) override;
private:
struct CKBThemeData {
@@ -41,31 +41,31 @@
CXFA_Graphics* pGraphics,
const CFX_RectF& pRtBox,
int32_t iState,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawSignCheck(CXFA_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawSignCircle(CXFA_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawSignCross(CXFA_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawSignDiamond(CXFA_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawSignSquare(CXFA_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawSignStar(CXFA_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void InitCheckPath(float fCheckLen);
void SetThemeData();
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp
index 8c35e56..f5cfeb5 100644
--- a/xfa/fwl/theme/cfwl_comboboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp
@@ -17,22 +17,19 @@
CFWL_ComboBoxTP::~CFWL_ComboBoxTP() {}
-void CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- if (!pParams)
- return;
-
- switch (pParams->m_iPart) {
+void CFWL_ComboBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
+ switch (pParams.m_iPart) {
case CFWL_Part::Border: {
- DrawBorder(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
- &pParams->m_matrix);
+ DrawBorder(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
+ &pParams.m_matrix);
break;
}
case CFWL_Part::Background: {
CXFA_GEPath path;
- CFX_RectF& rect = pParams->m_rtPart;
+ const CFX_RectF& rect = pParams.m_rtPart;
path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
FX_ARGB argb_color;
- switch (pParams->m_dwStates) {
+ switch (pParams.m_dwStates) {
case CFWL_PartState_Selected:
argb_color = FWLTHEME_COLOR_BKSelected;
break;
@@ -42,18 +39,18 @@
default:
argb_color = 0xFFFFFFFF;
}
- pParams->m_pGraphics->SaveGraphState();
- pParams->m_pGraphics->SetFillColor(CXFA_GEColor(argb_color));
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix);
- pParams->m_pGraphics->RestoreGraphState();
+ pParams.m_pGraphics->SaveGraphState();
+ pParams.m_pGraphics->SetFillColor(CXFA_GEColor(argb_color));
+ pParams.m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams.m_matrix);
+ pParams.m_pGraphics->RestoreGraphState();
break;
}
case CFWL_Part::DropDownButton: {
- DrawDropDownButton(pParams, pParams->m_dwStates, &pParams->m_matrix);
+ DrawDropDownButton(pParams, pParams.m_dwStates, &pParams.m_matrix);
break;
}
case CFWL_Part::StretchHandler: {
- DrawStrethHandler(pParams, 0, &pParams->m_matrix);
+ DrawStretchHandler(pParams, 0, &pParams.m_matrix);
break;
}
default:
@@ -61,20 +58,19 @@
}
}
-void CFWL_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams,
- uint32_t dwStates,
- CFX_Matrix* pMatrix) {
+void CFWL_ComboBoxTP::DrawStretchHandler(const CFWL_ThemeBackground& pParams,
+ uint32_t dwStates,
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
- path.AddRectangle(pParams->m_rtPart.left, pParams->m_rtPart.top,
- pParams->m_rtPart.width - 1, pParams->m_rtPart.height);
- pParams->m_pGraphics->SetFillColor(
- CXFA_GEColor(ArgbEncode(0xff, 0xff, 0, 0)));
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix);
+ path.AddRectangle(pParams.m_rtPart.left, pParams.m_rtPart.top,
+ pParams.m_rtPart.width - 1, pParams.m_rtPart.height);
+ pParams.m_pGraphics->SetFillColor(CXFA_GEColor(ArgbEncode(0xff, 0xff, 0, 0)));
+ pParams.m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams.m_matrix);
}
-void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
+void CFWL_ComboBoxTP::DrawDropDownButton(const CFWL_ThemeBackground& pParams,
uint32_t dwStates,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
FWLTHEME_STATE eState = FWLTHEME_STATE_Normal;
switch (dwStates) {
case CFWL_PartState_Normal: {
@@ -96,6 +92,6 @@
default:
break;
}
- DrawArrowBtn(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
- FWLTHEME_DIRECTION_Down, eState, &pParams->m_matrix);
+ DrawArrowBtn(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
+ FWLTHEME_DIRECTION_Down, eState, &pParams.m_matrix);
}
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.h b/xfa/fwl/theme/cfwl_comboboxtp.h
index 1456143..11f23d8 100644
--- a/xfa/fwl/theme/cfwl_comboboxtp.h
+++ b/xfa/fwl/theme/cfwl_comboboxtp.h
@@ -15,15 +15,15 @@
~CFWL_ComboBoxTP() override;
// CFWL_WidgetTP
- void DrawBackground(CFWL_ThemeBackground* pParams) override;
+ void DrawBackground(const CFWL_ThemeBackground& pParams) override;
private:
- void DrawDropDownButton(CFWL_ThemeBackground* pParams,
+ void DrawDropDownButton(const CFWL_ThemeBackground& pParams,
uint32_t dwStates,
- CFX_Matrix* pMatrix);
- void DrawStrethHandler(CFWL_ThemeBackground* pParams,
- uint32_t dwStates,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
+ void DrawStretchHandler(const CFWL_ThemeBackground& pParams,
+ uint32_t dwStates,
+ const CFX_Matrix* pMatrix);
};
#endif // XFA_FWL_THEME_CFWL_COMBOBOXTP_H_
diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.cpp b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
index d13d4c7..b529575 100644
--- a/xfa/fwl/theme/cfwl_datetimepickertp.cpp
+++ b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
@@ -13,26 +13,25 @@
CFWL_DateTimePickerTP::~CFWL_DateTimePickerTP() {}
-void CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- if (!pParams)
- return;
-
- switch (pParams->m_iPart) {
+void CFWL_DateTimePickerTP::DrawBackground(
+ const CFWL_ThemeBackground& pParams) {
+ switch (pParams.m_iPart) {
case CFWL_Part::Border:
- DrawBorder(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
- &pParams->m_matrix);
+ DrawBorder(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
+ &pParams.m_matrix);
break;
case CFWL_Part::DropDownButton:
- DrawDropDownButton(pParams, &pParams->m_matrix);
+ DrawDropDownButton(pParams, &pParams.m_matrix);
break;
default:
break;
}
}
-void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
- CFX_Matrix* pMatrix) {
- uint32_t dwStates = pParams->m_dwStates;
+void CFWL_DateTimePickerTP::DrawDropDownButton(
+ const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix) {
+ uint32_t dwStates = pParams.m_dwStates;
dwStates &= 0x03;
FWLTHEME_STATE eState = FWLTHEME_STATE_Normal;
switch (eState & dwStates) {
@@ -55,7 +54,6 @@
default:
break;
}
- DrawArrowBtn(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
+ DrawArrowBtn(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
FWLTHEME_DIRECTION_Down, eState, pMatrix);
}
-
diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.h b/xfa/fwl/theme/cfwl_datetimepickertp.h
index e7a7239..b74600f 100644
--- a/xfa/fwl/theme/cfwl_datetimepickertp.h
+++ b/xfa/fwl/theme/cfwl_datetimepickertp.h
@@ -15,10 +15,11 @@
~CFWL_DateTimePickerTP() override;
// CFWL_WidgetTP
- void DrawBackground(CFWL_ThemeBackground* pParams) override;
+ void DrawBackground(const CFWL_ThemeBackground& pParams) override;
private:
- void DrawDropDownButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
+ void DrawDropDownButton(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix);
};
#endif // XFA_FWL_THEME_CFWL_DATETIMEPICKERTP_H_
diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp
index eb1f24e..16d3f79 100644
--- a/xfa/fwl/theme/cfwl_edittp.cpp
+++ b/xfa/fwl/theme/cfwl_edittp.cpp
@@ -20,9 +20,9 @@
CFWL_EditTP::~CFWL_EditTP() {}
-void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- if (CFWL_Part::CombTextLine == pParams->m_iPart) {
- CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget);
+void CFWL_EditTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
+ if (CFWL_Part::CombTextLine == pParams.m_iPart) {
+ CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams.m_pWidget);
ASSERT(pWidget->GetNode()->IsWidgetReady());
CXFA_Border* borderUI = pWidget->GetNode()->GetUIBorder();
@@ -35,53 +35,50 @@
fWidth = edge->GetThickness();
}
}
- pParams->m_pGraphics->SetStrokeColor(CXFA_GEColor(cr));
- pParams->m_pGraphics->SetLineWidth(fWidth);
- pParams->m_pGraphics->StrokePath(pParams->m_pPath.Get(),
- &pParams->m_matrix);
+ pParams.m_pGraphics->SetStrokeColor(CXFA_GEColor(cr));
+ pParams.m_pGraphics->SetLineWidth(fWidth);
+ pParams.m_pGraphics->StrokePath(pParams.m_pPath.Get(), &pParams.m_matrix);
return;
}
- switch (pParams->m_iPart) {
+ switch (pParams.m_iPart) {
case CFWL_Part::Border: {
- DrawBorder(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
- &pParams->m_matrix);
+ DrawBorder(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
+ &pParams.m_matrix);
break;
}
case CFWL_Part::Background: {
- if (pParams->m_pPath) {
- CXFA_Graphics* pGraphics = pParams->m_pGraphics.Get();
+ if (pParams.m_pPath) {
+ CXFA_Graphics* pGraphics = pParams.m_pGraphics.Get();
pGraphics->SaveGraphState();
pGraphics->SetFillColor(CXFA_GEColor(FWLTHEME_COLOR_BKSelected));
- pGraphics->FillPath(pParams->m_pPath.Get(), FXFILL_WINDING,
- &pParams->m_matrix);
+ pGraphics->FillPath(pParams.m_pPath.Get(), FXFILL_WINDING,
+ &pParams.m_matrix);
pGraphics->RestoreGraphState();
} else {
CXFA_GEPath path;
- path.AddRectangle(pParams->m_rtPart.left, pParams->m_rtPart.top,
- pParams->m_rtPart.width, pParams->m_rtPart.height);
+ path.AddRectangle(pParams.m_rtPart.left, pParams.m_rtPart.top,
+ pParams.m_rtPart.width, pParams.m_rtPart.height);
CXFA_GEColor cr(FWLTHEME_COLOR_Background);
- if (!pParams->m_bStaticBackground) {
- if (pParams->m_dwStates & CFWL_PartState_Disabled)
+ if (!pParams.m_bStaticBackground) {
+ if (pParams.m_dwStates & CFWL_PartState_Disabled)
cr = CXFA_GEColor(FWLTHEME_COLOR_EDGERB1);
- else if (pParams->m_dwStates & CFWL_PartState_ReadOnly)
+ else if (pParams.m_dwStates & CFWL_PartState_ReadOnly)
cr = CXFA_GEColor(ArgbEncode(255, 236, 233, 216));
else
cr = CXFA_GEColor(0xFFFFFFFF);
}
- pParams->m_pGraphics->SaveGraphState();
- pParams->m_pGraphics->SetFillColor(cr);
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING,
- &pParams->m_matrix);
- pParams->m_pGraphics->RestoreGraphState();
+ pParams.m_pGraphics->SaveGraphState();
+ pParams.m_pGraphics->SetFillColor(cr);
+ pParams.m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams.m_matrix);
+ pParams.m_pGraphics->RestoreGraphState();
}
break;
}
case CFWL_Part::CombTextLine: {
- pParams->m_pGraphics->SetStrokeColor(CXFA_GEColor(0xFF000000));
- pParams->m_pGraphics->SetLineWidth(1.0f);
- pParams->m_pGraphics->StrokePath(pParams->m_pPath.Get(),
- &pParams->m_matrix);
+ pParams.m_pGraphics->SetStrokeColor(CXFA_GEColor(0xFF000000));
+ pParams.m_pGraphics->SetLineWidth(1.0f);
+ pParams.m_pGraphics->StrokePath(pParams.m_pPath.Get(), &pParams.m_matrix);
break;
}
default:
diff --git a/xfa/fwl/theme/cfwl_edittp.h b/xfa/fwl/theme/cfwl_edittp.h
index 7d00560..b5b58f3 100644
--- a/xfa/fwl/theme/cfwl_edittp.h
+++ b/xfa/fwl/theme/cfwl_edittp.h
@@ -14,8 +14,8 @@
CFWL_EditTP();
~CFWL_EditTP() override;
- // CFWL_WidgeTTP
- void DrawBackground(CFWL_ThemeBackground* pParams) override;
+ // CFWL_WidgetTP
+ void DrawBackground(const CFWL_ThemeBackground& pParams) override;
};
#endif // XFA_FWL_THEME_CFWL_EDITTP_H_
diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp
index fc0f54e..b98890a 100644
--- a/xfa/fwl/theme/cfwl_listboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -16,40 +16,36 @@
CFWL_ListBoxTP::~CFWL_ListBoxTP() {}
-void CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- if (!pParams)
- return;
-
- switch (pParams->m_iPart) {
+void CFWL_ListBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
+ switch (pParams.m_iPart) {
case CFWL_Part::Border: {
- DrawBorder(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
- &pParams->m_matrix);
+ DrawBorder(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
+ &pParams.m_matrix);
break;
}
case CFWL_Part::Background: {
- FillSolidRect(pParams->m_pGraphics.Get(), ArgbEncode(255, 255, 255, 255),
- &pParams->m_rtPart, &pParams->m_matrix);
- if (pParams->m_pRtData) {
- FillSolidRect(pParams->m_pGraphics.Get(), FWLTHEME_COLOR_Background,
- pParams->m_pRtData, &pParams->m_matrix);
+ FillSolidRect(pParams.m_pGraphics.Get(), ArgbEncode(255, 255, 255, 255),
+ &pParams.m_rtPart, &pParams.m_matrix);
+ if (pParams.m_pRtData) {
+ FillSolidRect(pParams.m_pGraphics.Get(), FWLTHEME_COLOR_Background,
+ pParams.m_pRtData, &pParams.m_matrix);
}
break;
}
case CFWL_Part::ListItem: {
- DrawListBoxItem(pParams->m_pGraphics.Get(), pParams->m_dwStates,
- &pParams->m_rtPart, pParams->m_pRtData,
- &pParams->m_matrix);
+ DrawListBoxItem(pParams.m_pGraphics.Get(), pParams.m_dwStates,
+ &pParams.m_rtPart, pParams.m_pRtData, &pParams.m_matrix);
break;
}
case CFWL_Part::Check: {
uint32_t color = 0xFF000000;
- if (pParams->m_dwStates == CFWL_PartState_Checked) {
+ if (pParams.m_dwStates == CFWL_PartState_Checked) {
color = 0xFFFF0000;
- } else if (pParams->m_dwStates == CFWL_PartState_Normal) {
+ } else if (pParams.m_dwStates == CFWL_PartState_Normal) {
color = 0xFF0000FF;
}
- FillSolidRect(pParams->m_pGraphics.Get(), color, &pParams->m_rtPart,
- &pParams->m_matrix);
+ FillSolidRect(pParams.m_pGraphics.Get(), color, &pParams.m_rtPart,
+ &pParams.m_matrix);
break;
}
default:
@@ -61,7 +57,7 @@
uint32_t dwStates,
const CFX_RectF* prtItem,
void* pData,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
if (dwStates & CFWL_PartState_Selected) {
pGraphics->SaveGraphState();
pGraphics->SetFillColor(CXFA_GEColor(FWLTHEME_COLOR_BKSelected));
diff --git a/xfa/fwl/theme/cfwl_listboxtp.h b/xfa/fwl/theme/cfwl_listboxtp.h
index e87ac6f..03cc905 100644
--- a/xfa/fwl/theme/cfwl_listboxtp.h
+++ b/xfa/fwl/theme/cfwl_listboxtp.h
@@ -15,14 +15,14 @@
~CFWL_ListBoxTP() override;
// CFWL_WidgetTP
- void DrawBackground(CFWL_ThemeBackground* pParams) override;
+ void DrawBackground(const CFWL_ThemeBackground& pParams) override;
private:
void DrawListBoxItem(CXFA_Graphics* pGraphics,
uint32_t dwStates,
const CFX_RectF* prtItem,
void* pData,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
};
#endif // XFA_FWL_THEME_CFWL_LISTBOXTP_H_
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index c17451d..cb0fe98 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -31,54 +31,51 @@
CFWL_WidgetTP::Finalize();
}
-void CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- if (!pParams)
- return;
-
- switch (pParams->m_iPart) {
+void CFWL_MonthCalendarTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
+ switch (pParams.m_iPart) {
case CFWL_Part::Border: {
- DrawBorder(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
- &pParams->m_matrix);
+ DrawBorder(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
+ &pParams.m_matrix);
break;
}
case CFWL_Part::Background: {
- DrawTotalBK(pParams, &pParams->m_matrix);
+ DrawTotalBK(pParams, &pParams.m_matrix);
break;
}
case CFWL_Part::Header: {
- DrawHeadBk(pParams, &pParams->m_matrix);
+ DrawHeadBk(pParams, &pParams.m_matrix);
break;
}
case CFWL_Part::LBtn: {
- FWLTHEME_STATE eState = GetState(pParams->m_dwStates);
- DrawArrowBtn(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
- FWLTHEME_DIRECTION_Left, eState, &pParams->m_matrix);
+ FWLTHEME_STATE eState = GetState(pParams.m_dwStates);
+ DrawArrowBtn(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
+ FWLTHEME_DIRECTION_Left, eState, &pParams.m_matrix);
break;
}
case CFWL_Part::RBtn: {
- FWLTHEME_STATE eState = GetState(pParams->m_dwStates);
- DrawArrowBtn(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
- FWLTHEME_DIRECTION_Right, eState, &pParams->m_matrix);
+ FWLTHEME_STATE eState = GetState(pParams.m_dwStates);
+ DrawArrowBtn(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
+ FWLTHEME_DIRECTION_Right, eState, &pParams.m_matrix);
break;
}
case CFWL_Part::HSeparator: {
- DrawHSeperator(pParams, &pParams->m_matrix);
+ DrawHSeperator(pParams, &pParams.m_matrix);
break;
}
case CFWL_Part::DatesIn: {
- DrawDatesInBK(pParams, &pParams->m_matrix);
+ DrawDatesInBK(pParams, &pParams.m_matrix);
break;
}
case CFWL_Part::TodayCircle: {
- DrawTodayCircle(pParams, &pParams->m_matrix);
+ DrawTodayCircle(pParams, &pParams.m_matrix);
break;
}
case CFWL_Part::DateInCircle: {
- DrawDatesInCircle(pParams, &pParams->m_matrix);
+ DrawDatesInCircle(pParams, &pParams.m_matrix);
break;
}
case CFWL_Part::WeekNumSep: {
- DrawWeekNumSep(pParams, &pParams->m_matrix);
+ DrawWeekNumSep(pParams, &pParams.m_matrix);
break;
}
default:
@@ -86,16 +83,16 @@
}
}
-void CFWL_MonthCalendarTP::DrawText(CFWL_ThemeText* pParams) {
+void CFWL_MonthCalendarTP::DrawText(const CFWL_ThemeText& pParams) {
if (!m_pTextOut)
return;
- if ((pParams->m_iPart == CFWL_Part::DatesIn) &&
- !(pParams->m_dwStates & FWL_ITEMSTATE_MCD_Flag) &&
- (pParams->m_dwStates &
+ if ((pParams.m_iPart == CFWL_Part::DatesIn) &&
+ !(pParams.m_dwStates & FWL_ITEMSTATE_MCD_Flag) &&
+ (pParams.m_dwStates &
(CFWL_PartState_Hovered | CFWL_PartState_Selected))) {
m_pTextOut->SetTextColor(0xFFFFFFFF);
- } else if (pParams->m_iPart == CFWL_Part::Caption) {
+ } else if (pParams.m_iPart == CFWL_Part::Caption) {
m_pTextOut->SetTextColor(m_pThemeData->clrCaption);
} else {
m_pTextOut->SetTextColor(0xFF000000);
@@ -103,45 +100,45 @@
CFWL_WidgetTP::DrawText(pParams);
}
-void CFWL_MonthCalendarTP::DrawTotalBK(CFWL_ThemeBackground* pParams,
- CFX_Matrix* pMatrix) {
+void CFWL_MonthCalendarTP::DrawTotalBK(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
- CFX_RectF rtTotal(pParams->m_rtPart);
+ CFX_RectF rtTotal(pParams.m_rtPart);
path.AddRectangle(rtTotal.left, rtTotal.top, rtTotal.width, rtTotal.height);
- pParams->m_pGraphics->SaveGraphState();
- pParams->m_pGraphics->SetFillColor(CXFA_GEColor(m_pThemeData->clrBK));
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
- pParams->m_pGraphics->RestoreGraphState();
+ pParams.m_pGraphics->SaveGraphState();
+ pParams.m_pGraphics->SetFillColor(CXFA_GEColor(m_pThemeData->clrBK));
+ pParams.m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
+ pParams.m_pGraphics->RestoreGraphState();
}
-void CFWL_MonthCalendarTP::DrawHeadBk(CFWL_ThemeBackground* pParams,
- CFX_Matrix* pMatrix) {
+void CFWL_MonthCalendarTP::DrawHeadBk(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
- CFX_RectF rtHead = pParams->m_rtPart;
+ CFX_RectF rtHead = pParams.m_rtPart;
path.AddRectangle(rtHead.left, rtHead.top, rtHead.width, rtHead.height);
- pParams->m_pGraphics->SaveGraphState();
- pParams->m_pGraphics->SetFillColor(CXFA_GEColor(m_pThemeData->clrBK));
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
- pParams->m_pGraphics->RestoreGraphState();
+ pParams.m_pGraphics->SaveGraphState();
+ pParams.m_pGraphics->SetFillColor(CXFA_GEColor(m_pThemeData->clrBK));
+ pParams.m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
+ pParams.m_pGraphics->RestoreGraphState();
}
-void CFWL_MonthCalendarTP::DrawLButton(CFWL_ThemeBackground* pParams,
- CFX_Matrix* pMatrix) {
+void CFWL_MonthCalendarTP::DrawLButton(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
- CFX_RectF rtLBtn = pParams->m_rtPart;
+ CFX_RectF rtLBtn = pParams.m_rtPart;
path.AddRectangle(rtLBtn.left, rtLBtn.top, rtLBtn.width, rtLBtn.height);
- pParams->m_pGraphics->SaveGraphState();
- pParams->m_pGraphics->SetStrokeColor(
+ pParams.m_pGraphics->SaveGraphState();
+ pParams.m_pGraphics->SetStrokeColor(
CXFA_GEColor(ArgbEncode(0xff, 205, 219, 243)));
- pParams->m_pGraphics->StrokePath(&path, pMatrix);
- if (pParams->m_dwStates & CFWL_PartState_Pressed) {
- pParams->m_pGraphics->SetFillColor(
+ pParams.m_pGraphics->StrokePath(&path, pMatrix);
+ if (pParams.m_dwStates & CFWL_PartState_Pressed) {
+ pParams.m_pGraphics->SetFillColor(
CXFA_GEColor(ArgbEncode(0xff, 174, 198, 242)));
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
+ pParams.m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
} else {
- pParams->m_pGraphics->SetFillColor(
+ pParams.m_pGraphics->SetFillColor(
CXFA_GEColor(ArgbEncode(0xff, 227, 235, 249)));
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
+ pParams.m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
}
path.Clear();
@@ -152,29 +149,29 @@
path.LineTo(CFX_PointF(rtLBtn.left + rtLBtn.Width() / 3 * 2,
rtLBtn.bottom() - rtLBtn.height / 4));
- pParams->m_pGraphics->SetStrokeColor(
+ pParams.m_pGraphics->SetStrokeColor(
CXFA_GEColor(ArgbEncode(0xff, 50, 104, 205)));
- pParams->m_pGraphics->StrokePath(&path, pMatrix);
- pParams->m_pGraphics->RestoreGraphState();
+ pParams.m_pGraphics->StrokePath(&path, pMatrix);
+ pParams.m_pGraphics->RestoreGraphState();
}
-void CFWL_MonthCalendarTP::DrawRButton(CFWL_ThemeBackground* pParams,
- CFX_Matrix* pMatrix) {
+void CFWL_MonthCalendarTP::DrawRButton(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
- CFX_RectF rtRBtn = pParams->m_rtPart;
+ CFX_RectF rtRBtn = pParams.m_rtPart;
path.AddRectangle(rtRBtn.left, rtRBtn.top, rtRBtn.width, rtRBtn.height);
- pParams->m_pGraphics->SaveGraphState();
- pParams->m_pGraphics->SetStrokeColor(
+ pParams.m_pGraphics->SaveGraphState();
+ pParams.m_pGraphics->SetStrokeColor(
CXFA_GEColor(ArgbEncode(0xff, 205, 219, 243)));
- pParams->m_pGraphics->StrokePath(&path, pMatrix);
- if (pParams->m_dwStates & CFWL_PartState_Pressed) {
- pParams->m_pGraphics->SetFillColor(
+ pParams.m_pGraphics->StrokePath(&path, pMatrix);
+ if (pParams.m_dwStates & CFWL_PartState_Pressed) {
+ pParams.m_pGraphics->SetFillColor(
CXFA_GEColor(ArgbEncode(0xff, 174, 198, 242)));
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
+ pParams.m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
} else {
- pParams->m_pGraphics->SetFillColor(
+ pParams.m_pGraphics->SetFillColor(
CXFA_GEColor(ArgbEncode(0xff, 227, 235, 249)));
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
+ pParams.m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
}
path.Clear();
@@ -185,85 +182,84 @@
path.LineTo(CFX_PointF(rtRBtn.left + rtRBtn.Width() / 3,
rtRBtn.bottom() - rtRBtn.height / 4));
- pParams->m_pGraphics->SetStrokeColor(
+ pParams.m_pGraphics->SetStrokeColor(
CXFA_GEColor(ArgbEncode(0xff, 50, 104, 205)));
- pParams->m_pGraphics->StrokePath(&path, pMatrix);
- pParams->m_pGraphics->RestoreGraphState();
+ pParams.m_pGraphics->StrokePath(&path, pMatrix);
+ pParams.m_pGraphics->RestoreGraphState();
}
-void CFWL_MonthCalendarTP::DrawHSeperator(CFWL_ThemeBackground* pParams,
- CFX_Matrix* pMatrix) {
+void CFWL_MonthCalendarTP::DrawHSeperator(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
- CFX_RectF rtHSep = pParams->m_rtPart;
+ CFX_RectF rtHSep = pParams.m_rtPart;
path.MoveTo(CFX_PointF(rtHSep.left, rtHSep.top + rtHSep.height / 2));
path.LineTo(CFX_PointF(rtHSep.right(), rtHSep.top + rtHSep.height / 2));
- pParams->m_pGraphics->SaveGraphState();
- pParams->m_pGraphics->SetStrokeColor(
- CXFA_GEColor(m_pThemeData->clrSeperator));
- pParams->m_pGraphics->StrokePath(&path, pMatrix);
- pParams->m_pGraphics->RestoreGraphState();
+ pParams.m_pGraphics->SaveGraphState();
+ pParams.m_pGraphics->SetStrokeColor(CXFA_GEColor(m_pThemeData->clrSeperator));
+ pParams.m_pGraphics->StrokePath(&path, pMatrix);
+ pParams.m_pGraphics->RestoreGraphState();
}
-void CFWL_MonthCalendarTP::DrawWeekNumSep(CFWL_ThemeBackground* pParams,
- CFX_Matrix* pMatrix) {
+void CFWL_MonthCalendarTP::DrawWeekNumSep(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
- CFX_RectF rtWeekSep = pParams->m_rtPart;
+ CFX_RectF rtWeekSep = pParams.m_rtPart;
path.MoveTo(rtWeekSep.TopLeft());
path.LineTo(rtWeekSep.BottomLeft());
- pParams->m_pGraphics->SaveGraphState();
- pParams->m_pGraphics->SetStrokeColor(
- CXFA_GEColor(m_pThemeData->clrSeperator));
- pParams->m_pGraphics->StrokePath(&path, pMatrix);
- pParams->m_pGraphics->RestoreGraphState();
+ pParams.m_pGraphics->SaveGraphState();
+ pParams.m_pGraphics->SetStrokeColor(CXFA_GEColor(m_pThemeData->clrSeperator));
+ pParams.m_pGraphics->StrokePath(&path, pMatrix);
+ pParams.m_pGraphics->RestoreGraphState();
}
-void CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams,
- CFX_Matrix* pMatrix) {
- pParams->m_pGraphics->SaveGraphState();
- if (pParams->m_dwStates & CFWL_PartState_Selected) {
+void CFWL_MonthCalendarTP::DrawDatesInBK(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix) {
+ pParams.m_pGraphics->SaveGraphState();
+ if (pParams.m_dwStates & CFWL_PartState_Selected) {
CXFA_GEPath path;
- CFX_RectF rtSelDay = pParams->m_rtPart;
+ CFX_RectF rtSelDay = pParams.m_rtPart;
path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width,
rtSelDay.height);
- pParams->m_pGraphics->SetFillColor(
+ pParams.m_pGraphics->SetFillColor(
CXFA_GEColor(m_pThemeData->clrDatesSelectedBK));
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
- } else if (pParams->m_dwStates & CFWL_PartState_Hovered) {
+ pParams.m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
+ } else if (pParams.m_dwStates & CFWL_PartState_Hovered) {
CXFA_GEPath path;
- CFX_RectF rtSelDay = pParams->m_rtPart;
+ CFX_RectF rtSelDay = pParams.m_rtPart;
path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width,
rtSelDay.height);
- pParams->m_pGraphics->SetFillColor(
+ pParams.m_pGraphics->SetFillColor(
CXFA_GEColor(m_pThemeData->clrDatesHoverBK));
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
+ pParams.m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
}
- pParams->m_pGraphics->RestoreGraphState();
+ pParams.m_pGraphics->RestoreGraphState();
}
-void CFWL_MonthCalendarTP::DrawDatesInCircle(CFWL_ThemeBackground* pParams,
- CFX_Matrix* pMatrix) {
+void CFWL_MonthCalendarTP::DrawDatesInCircle(
+ const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
- CFX_RectF rtSelDay = pParams->m_rtPart;
+ CFX_RectF rtSelDay = pParams.m_rtPart;
path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width,
rtSelDay.height);
- pParams->m_pGraphics->SaveGraphState();
- pParams->m_pGraphics->SetStrokeColor(
+ pParams.m_pGraphics->SaveGraphState();
+ pParams.m_pGraphics->SetStrokeColor(
CXFA_GEColor(m_pThemeData->clrDatesCircle));
- pParams->m_pGraphics->StrokePath(&path, pMatrix);
- pParams->m_pGraphics->RestoreGraphState();
+ pParams.m_pGraphics->StrokePath(&path, pMatrix);
+ pParams.m_pGraphics->RestoreGraphState();
}
-void CFWL_MonthCalendarTP::DrawTodayCircle(CFWL_ThemeBackground* pParams,
- CFX_Matrix* pMatrix) {
+void CFWL_MonthCalendarTP::DrawTodayCircle(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
- CFX_RectF rtTodayCircle = pParams->m_rtPart;
+ CFX_RectF rtTodayCircle = pParams.m_rtPart;
path.AddRectangle(rtTodayCircle.left, rtTodayCircle.top, rtTodayCircle.width,
rtTodayCircle.height);
- pParams->m_pGraphics->SaveGraphState();
- pParams->m_pGraphics->SetStrokeColor(
+ pParams.m_pGraphics->SaveGraphState();
+ pParams.m_pGraphics->SetStrokeColor(
CXFA_GEColor(m_pThemeData->clrDatesCircle));
- pParams->m_pGraphics->StrokePath(&path, pMatrix);
- pParams->m_pGraphics->RestoreGraphState();
+ pParams.m_pGraphics->StrokePath(&path, pMatrix);
+ pParams.m_pGraphics->RestoreGraphState();
}
FWLTHEME_STATE CFWL_MonthCalendarTP::GetState(uint32_t dwFWLStates) {
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h
index 4dd08b4..ee6661a 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.h
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.h
@@ -19,8 +19,8 @@
// CFWL_WidgetTP
void Initialize() override;
void Finalize() override;
- void DrawBackground(CFWL_ThemeBackground* pParams) override;
- void DrawText(CFWL_ThemeText* pParams) override;
+ void DrawBackground(const CFWL_ThemeBackground& pParams) override;
+ void DrawText(const CFWL_ThemeText& pParams) override;
private:
struct MCThemeData {
@@ -33,15 +33,24 @@
FX_ARGB clrBK;
};
- void DrawTotalBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
- void DrawHeadBk(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
- void DrawLButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
- void DrawRButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
- void DrawDatesInBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
- void DrawDatesInCircle(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
- void DrawTodayCircle(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
- void DrawHSeperator(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
- void DrawWeekNumSep(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
+ void DrawTotalBK(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix);
+ void DrawHeadBk(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix);
+ void DrawLButton(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix);
+ void DrawRButton(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix);
+ void DrawDatesInBK(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix);
+ void DrawDatesInCircle(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix);
+ void DrawTodayCircle(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix);
+ void DrawHSeperator(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix);
+ void DrawWeekNumSep(const CFWL_ThemeBackground& pParams,
+ const CFX_Matrix* pMatrix);
FWLTHEME_STATE GetState(uint32_t dwFWLStates);
void SetThemeData();
diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.cpp b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
index 6a30113..851eb74 100644
--- a/xfa/fwl/theme/cfwl_pictureboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
@@ -14,14 +14,11 @@
CFWL_PictureBoxTP::~CFWL_PictureBoxTP() {}
-void CFWL_PictureBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- if (!pParams)
- return;
-
- switch (pParams->m_iPart) {
+void CFWL_PictureBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
+ switch (pParams.m_iPart) {
case CFWL_Part::Border:
- DrawBorder(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
- &pParams->m_matrix);
+ DrawBorder(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
+ &pParams.m_matrix);
break;
default:
break;
diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.h b/xfa/fwl/theme/cfwl_pictureboxtp.h
index 1bb3486..4bb295a 100644
--- a/xfa/fwl/theme/cfwl_pictureboxtp.h
+++ b/xfa/fwl/theme/cfwl_pictureboxtp.h
@@ -15,7 +15,7 @@
~CFWL_PictureBoxTP() override;
// CFWL_WidgetTP
- void DrawBackground(CFWL_ThemeBackground* pParams) override;
+ void DrawBackground(const CFWL_ThemeBackground& pParams) override;
};
#endif // XFA_FWL_THEME_CFWL_PICTUREBOXTP_H_
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index dbd6800..9b5d416 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -21,15 +21,15 @@
CFWL_PushButtonTP::~CFWL_PushButtonTP() {}
-void CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- switch (pParams->m_iPart) {
+void CFWL_PushButtonTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
+ switch (pParams.m_iPart) {
case CFWL_Part::Border: {
- DrawBorder(pParams->m_pGraphics.Get(), &pParams->m_rtPart,
- &pParams->m_matrix);
+ DrawBorder(pParams.m_pGraphics.Get(), &pParams.m_rtPart,
+ &pParams.m_matrix);
break;
}
case CFWL_Part::Background: {
- CFX_RectF& rect = pParams->m_rtPart;
+ const CFX_RectF& rect = pParams.m_rtPart;
float fRight = rect.right();
float fBottom = rect.bottom();
@@ -52,7 +52,7 @@
CXFA_GEPath fillPath;
fillPath.AddSubpath(&strokePath);
- CXFA_Graphics* pGraphics = pParams->m_pGraphics.Get();
+ CXFA_Graphics* pGraphics = pParams.m_pGraphics.Get();
pGraphics->SaveGraphState();
CFX_RectF rtInner(rect);
@@ -61,22 +61,22 @@
fillPath.AddRectangle(rtInner.left, rtInner.top, rtInner.width,
rtInner.height);
- int32_t iColor = GetColorID(pParams->m_dwStates);
+ int32_t iColor = GetColorID(pParams.m_dwStates);
FillSolidRect(pGraphics, m_pThemeData->clrEnd[iColor], &rect,
- &pParams->m_matrix);
+ &pParams.m_matrix);
pGraphics->SetStrokeColor(CXFA_GEColor(m_pThemeData->clrBorder[iColor]));
- pGraphics->StrokePath(&strokePath, &pParams->m_matrix);
+ pGraphics->StrokePath(&strokePath, &pParams.m_matrix);
fillPath.Clear();
fillPath.AddRectangle(rtInner.left, rtInner.top, rtInner.width,
rtInner.height);
pGraphics->SetFillColor(CXFA_GEColor(m_pThemeData->clrFill[iColor]));
- pGraphics->FillPath(&fillPath, FXFILL_WINDING, &pParams->m_matrix);
- if (pParams->m_dwStates & CFWL_PartState_Focused) {
+ pGraphics->FillPath(&fillPath, FXFILL_WINDING, &pParams.m_matrix);
+ if (pParams.m_dwStates & CFWL_PartState_Focused) {
rtInner.Inflate(1, 1, 0, 0);
- DrawFocus(pGraphics, &rtInner, &pParams->m_matrix);
+ DrawFocus(pGraphics, &rtInner, &pParams.m_matrix);
}
pGraphics->RestoreGraphState();
break;
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.h b/xfa/fwl/theme/cfwl_pushbuttontp.h
index 6b49ba6..c3079dd 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.h
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.h
@@ -17,7 +17,7 @@
~CFWL_PushButtonTP() override;
// CFWL_WidgetTP
- void DrawBackground(CFWL_ThemeBackground* pParams) override;
+ void DrawBackground(const CFWL_ThemeBackground& pParams) override;
private:
struct PBThemeData {
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index 0f383e6..e46675e 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -25,45 +25,42 @@
CFWL_ScrollBarTP::~CFWL_ScrollBarTP() {}
-void CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- if (!pParams)
- return;
-
- CFWL_Widget* pWidget = pParams->m_pWidget;
+void CFWL_ScrollBarTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
+ CFWL_Widget* pWidget = pParams.m_pWidget;
FWLTHEME_STATE eState = FWLTHEME_STATE_Normal;
- if (pParams->m_dwStates & CFWL_PartState_Hovered)
+ if (pParams.m_dwStates & CFWL_PartState_Hovered)
eState = FWLTHEME_STATE_Hover;
- else if (pParams->m_dwStates & CFWL_PartState_Pressed)
+ else if (pParams.m_dwStates & CFWL_PartState_Pressed)
eState = FWLTHEME_STATE_Pressed;
- else if (pParams->m_dwStates & CFWL_PartState_Disabled)
+ else if (pParams.m_dwStates & CFWL_PartState_Disabled)
eState = FWLTHEME_STATE_Disable;
- CXFA_Graphics* pGraphics = pParams->m_pGraphics.Get();
- CFX_RectF* pRect = &pParams->m_rtPart;
+ CXFA_Graphics* pGraphics = pParams.m_pGraphics.Get();
+ const CFX_RectF* pRect = &pParams.m_rtPart;
bool bVert = !!pWidget->GetStylesEx();
- switch (pParams->m_iPart) {
+ switch (pParams.m_iPart) {
case CFWL_Part::ForeArrow: {
DrawMaxMinBtn(pGraphics, pRect,
bVert ? FWLTHEME_DIRECTION_Up : FWLTHEME_DIRECTION_Left,
- eState, &pParams->m_matrix);
+ eState, &pParams.m_matrix);
break;
}
case CFWL_Part::BackArrow: {
DrawMaxMinBtn(pGraphics, pRect,
bVert ? FWLTHEME_DIRECTION_Down : FWLTHEME_DIRECTION_Right,
- eState, &pParams->m_matrix);
+ eState, &pParams.m_matrix);
break;
}
case CFWL_Part::Thumb: {
- DrawThumbBtn(pGraphics, pRect, bVert, eState, true, &pParams->m_matrix);
+ DrawThumbBtn(pGraphics, pRect, bVert, eState, true, &pParams.m_matrix);
break;
}
case CFWL_Part::LowerTrack: {
- DrawTrack(pGraphics, pRect, bVert, eState, true, &pParams->m_matrix);
+ DrawTrack(pGraphics, pRect, bVert, eState, true, &pParams.m_matrix);
break;
}
case CFWL_Part::UpperTrack: {
- DrawTrack(pGraphics, pRect, bVert, eState, false, &pParams->m_matrix);
+ DrawTrack(pGraphics, pRect, bVert, eState, false, &pParams.m_matrix);
break;
}
default:
@@ -76,7 +73,7 @@
bool bVert,
FWLTHEME_STATE eState,
bool bPawButton,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disable)
return;
@@ -106,7 +103,7 @@
const CFX_RectF* pRect,
bool bVert,
FWLTHEME_STATE eState,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
CXFA_GEPath path;
if (bVert) {
float fPawLen = kPawLength;
@@ -190,7 +187,7 @@
bool bVert,
FWLTHEME_STATE eState,
bool bLowerTrack,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disable)
return;
@@ -218,7 +215,7 @@
const CFX_RectF* pRect,
FWLTHEME_DIRECTION eDict,
FWLTHEME_STATE eState,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
DrawTrack(pGraphics, pRect,
eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down,
eState, true, pMatrix);
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.h b/xfa/fwl/theme/cfwl_scrollbartp.h
index 2a202e1..2727a0b 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.h
+++ b/xfa/fwl/theme/cfwl_scrollbartp.h
@@ -17,7 +17,7 @@
~CFWL_ScrollBarTP() override;
// CFWL_WidgetTP
- void DrawBackground(CFWL_ThemeBackground* pParams) override;
+ void DrawBackground(const CFWL_ThemeBackground& pParams) override;
private:
struct SBThemeData {
@@ -34,23 +34,23 @@
bool bVert,
FWLTHEME_STATE eState,
bool bPawButton,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawTrack(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
bool bVert,
FWLTHEME_STATE eState,
bool bLowerTrack,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawMaxMinBtn(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
FWLTHEME_DIRECTION eDict,
FWLTHEME_STATE eState,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawPaw(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
bool bVert,
FWLTHEME_STATE eState,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void SetThemeData();
std::unique_ptr<SBThemeData> m_pThemeData;
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index bea8b3b..5c2bf22 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -35,26 +35,26 @@
FinalizeTTO();
}
-void CFWL_WidgetTP::DrawBackground(CFWL_ThemeBackground* pParams) {}
+void CFWL_WidgetTP::DrawBackground(const CFWL_ThemeBackground& pParams) {}
-void CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) {
+void CFWL_WidgetTP::DrawText(const CFWL_ThemeText& pParams) {
if (!m_pTextOut)
InitTTO();
- int32_t iLen = pParams->m_wsText.GetLength();
+ int32_t iLen = pParams.m_wsText.GetLength();
if (iLen <= 0)
return;
- CXFA_Graphics* pGraphics = pParams->m_pGraphics;
- m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
- m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
+ CXFA_Graphics* pGraphics = pParams.m_pGraphics;
+ m_pTextOut->SetStyles(pParams.m_dwTTOStyles);
+ m_pTextOut->SetAlignment(pParams.m_iTTOAlign);
- CFX_Matrix* pMatrix = &pParams->m_matrix;
- pMatrix->Concat(*pGraphics->GetMatrix());
- m_pTextOut->SetMatrix(*pMatrix);
+ CFX_Matrix matrix = pParams.m_matrix;
+ matrix.Concat(*pGraphics->GetMatrix());
+ m_pTextOut->SetMatrix(matrix);
m_pTextOut->DrawLogicText(pGraphics->GetRenderDevice(),
- WideStringView(pParams->m_wsText.c_str(), iLen),
- pParams->m_rtPart);
+ WideStringView(pParams.m_wsText.c_str(), iLen),
+ pParams.m_rtPart);
}
const RetainPtr<CFGAS_GEFont>& CFWL_WidgetTP::GetFont() const {
@@ -102,7 +102,7 @@
void CFWL_WidgetTP::DrawBorder(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
if (!pGraphics || !pRect)
return;
@@ -118,14 +118,14 @@
void CFWL_WidgetTP::FillBackground(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
FillSolidRect(pGraphics, FWLTHEME_COLOR_Background, pRect, pMatrix);
}
void CFWL_WidgetTP::FillSolidRect(CXFA_Graphics* pGraphics,
FX_ARGB fillColor,
const CFX_RectF* pRect,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
if (!pGraphics || !pRect)
return;
@@ -139,7 +139,7 @@
void CFWL_WidgetTP::DrawFocus(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
if (!pGraphics || !pRect)
return;
@@ -157,7 +157,7 @@
const CFX_RectF* pRect,
FWLTHEME_DIRECTION eDict,
FX_ARGB argSign,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
bool bVert =
(eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down);
float fLeft =
@@ -210,9 +210,8 @@
void CFWL_WidgetTP::DrawBtn(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
FWLTHEME_STATE eState,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
InitializeArrowColorData();
-
FillSolidRect(pGraphics, m_pColorData->clrEnd[eState - 1], pRect, pMatrix);
CXFA_GEPath path;
@@ -225,7 +224,7 @@
const CFX_RectF* pRect,
FWLTHEME_DIRECTION eDict,
FWLTHEME_STATE eState,
- CFX_Matrix* pMatrix) {
+ const CFX_Matrix* pMatrix) {
DrawBtn(pGraphics, pRect, eState, pMatrix);
InitializeArrowColorData();
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h
index 05f7174..732b510 100644
--- a/xfa/fwl/theme/cfwl_widgettp.h
+++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -29,8 +29,8 @@
virtual void Initialize();
virtual void Finalize();
- virtual void DrawBackground(CFWL_ThemeBackground* pParams);
- virtual void DrawText(CFWL_ThemeText* pParams);
+ virtual void DrawBackground(const CFWL_ThemeBackground& pParams);
+ virtual void DrawText(const CFWL_ThemeText& pParams);
const RetainPtr<CFGAS_GEFont>& GetFont() const;
@@ -50,31 +50,31 @@
void DrawBorder(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void FillBackground(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void FillSolidRect(CXFA_Graphics* pGraphics,
FX_ARGB fillColor,
const CFX_RectF* pRect,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawFocus(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawArrow(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
FWLTHEME_DIRECTION eDict,
FX_ARGB argSign,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawBtn(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
FWLTHEME_STATE eState,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
void DrawArrowBtn(CXFA_Graphics* pGraphics,
const CFX_RectF* pRect,
FWLTHEME_DIRECTION eDict,
FWLTHEME_STATE eState,
- CFX_Matrix* pMatrix);
+ const CFX_Matrix* pMatrix);
uint32_t m_dwRefCount;
std::unique_ptr<CFDE_TextOut> m_pTextOut;
diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp
index 820b294..1270025 100644
--- a/xfa/fxfa/cxfa_fwltheme.cpp
+++ b/xfa/fxfa/cxfa_fwltheme.cpp
@@ -84,75 +84,75 @@
FWLTHEME_Release();
}
-void CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) {
- GetTheme(pParams->m_pWidget)->DrawBackground(pParams);
+void CXFA_FWLTheme::DrawBackground(const CFWL_ThemeBackground& pParams) {
+ GetTheme(pParams.m_pWidget)->DrawBackground(pParams);
}
-void CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) {
- if (pParams->m_wsText.IsEmpty())
+void CXFA_FWLTheme::DrawText(const CFWL_ThemeText& pParams) {
+ if (pParams.m_wsText.IsEmpty())
return;
- if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) {
- CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget);
+ if (pParams.m_pWidget->GetClassID() == FWL_Type::MonthCalendar) {
+ CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams.m_pWidget);
if (!pWidget)
return;
- m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
- m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
+ m_pTextOut->SetStyles(pParams.m_dwTTOStyles);
+ m_pTextOut->SetAlignment(pParams.m_iTTOAlign);
m_pTextOut->SetFont(m_pCalendarFont);
m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize);
m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
- if ((pParams->m_iPart == CFWL_Part::DatesIn) &&
- !(pParams->m_dwStates & FWL_ITEMSTATE_MCD_Flag) &&
- (pParams->m_dwStates &
+ if ((pParams.m_iPart == CFWL_Part::DatesIn) &&
+ !(pParams.m_dwStates & FWL_ITEMSTATE_MCD_Flag) &&
+ (pParams.m_dwStates &
(CFWL_PartState_Hovered | CFWL_PartState_Selected))) {
m_pTextOut->SetTextColor(0xFF888888);
}
- if (pParams->m_iPart == CFWL_Part::Caption)
+ if (pParams.m_iPart == CFWL_Part::Caption)
m_pTextOut->SetTextColor(ArgbEncode(0xff, 0, 153, 255));
- CXFA_Graphics* pGraphics = pParams->m_pGraphics;
+ CXFA_Graphics* pGraphics = pParams.m_pGraphics;
CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice();
if (!pRenderDevice)
return;
- CFX_Matrix mtPart = pParams->m_matrix;
+ CFX_Matrix mtPart = pParams.m_matrix;
const CFX_Matrix* pMatrix = pGraphics->GetMatrix();
if (pMatrix)
mtPart.Concat(*pMatrix);
m_pTextOut->SetMatrix(mtPart);
- m_pTextOut->DrawLogicText(pRenderDevice, pParams->m_wsText.AsStringView(),
- pParams->m_rtPart);
+ m_pTextOut->DrawLogicText(pRenderDevice, pParams.m_wsText.AsStringView(),
+ pParams.m_rtPart);
return;
}
- CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget);
+ CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams.m_pWidget);
if (!pWidget)
return;
CXFA_Node* pNode = pWidget->GetNode();
- CXFA_Graphics* pGraphics = pParams->m_pGraphics;
+ CXFA_Graphics* pGraphics = pParams.m_pGraphics;
CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice();
if (!pRenderDevice)
return;
- m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
- m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
+ m_pTextOut->SetStyles(pParams.m_dwTTOStyles);
+ m_pTextOut->SetAlignment(pParams.m_iTTOAlign);
m_pTextOut->SetFont(pNode->GetFDEFont(pWidget->GetDoc()));
m_pTextOut->SetFontSize(pNode->GetFontSize());
m_pTextOut->SetTextColor(pNode->GetTextColor());
- CFX_Matrix mtPart = pParams->m_matrix;
+ CFX_Matrix mtPart = pParams.m_matrix;
const CFX_Matrix* pMatrix = pGraphics->GetMatrix();
if (pMatrix)
mtPart.Concat(*pMatrix);
m_pTextOut->SetMatrix(mtPart);
- m_pTextOut->DrawLogicText(pRenderDevice, pParams->m_wsText.AsStringView(),
- pParams->m_rtPart);
+ m_pTextOut->DrawLogicText(pRenderDevice, pParams.m_wsText.AsStringView(),
+ pParams.m_rtPart);
}
-CFX_RectF CXFA_FWLTheme::GetUIMargin(CFWL_ThemePart* pThemePart) const {
- CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget);
+CFX_RectF CXFA_FWLTheme::GetUIMargin(const CFWL_ThemePart& pThemePart) const {
+ CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart.m_pWidget);
if (!pWidget)
return CFX_RectF();
@@ -185,21 +185,21 @@
return 1.0f;
}
-float CXFA_FWLTheme::GetFontSize(CFWL_ThemePart* pThemePart) const {
- if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget))
+float CXFA_FWLTheme::GetFontSize(const CFWL_ThemePart& pThemePart) const {
+ if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart.m_pWidget))
return pWidget->GetNode()->GetFontSize();
return FWLTHEME_CAPACITY_FontSize;
}
RetainPtr<CFGAS_GEFont> CXFA_FWLTheme::GetFont(
- CFWL_ThemePart* pThemePart) const {
- if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget))
+ const CFWL_ThemePart& pThemePart) const {
+ if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart.m_pWidget))
return pWidget->GetNode()->GetFDEFont(pWidget->GetDoc());
- return GetTheme(pThemePart->m_pWidget)->GetFont();
+ return GetTheme(pThemePart.m_pWidget)->GetFont();
}
-float CXFA_FWLTheme::GetLineHeight(CFWL_ThemePart* pThemePart) const {
- if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget))
+float CXFA_FWLTheme::GetLineHeight(const CFWL_ThemePart& pThemePart) const {
+ if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart.m_pWidget))
return pWidget->GetNode()->GetLineHeight();
return kLineHeight;
}
@@ -208,15 +208,17 @@
return 9.0f;
}
-FX_COLORREF CXFA_FWLTheme::GetTextColor(CFWL_ThemePart* pThemePart) const {
- if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget))
+FX_COLORREF CXFA_FWLTheme::GetTextColor(
+ const CFWL_ThemePart& pThemePart) const {
+ if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart.m_pWidget))
return pWidget->GetNode()->GetTextColor();
return FWLTHEME_CAPACITY_TextColor;
}
-CFX_SizeF CXFA_FWLTheme::GetSpaceAboveBelow(CFWL_ThemePart* pThemePart) const {
+CFX_SizeF CXFA_FWLTheme::GetSpaceAboveBelow(
+ const CFWL_ThemePart& pThemePart) const {
CFX_SizeF sizeAboveBelow;
- if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) {
+ if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart.m_pWidget)) {
CXFA_Para* para = pWidget->GetNode()->GetParaIfExists();
if (para) {
sizeAboveBelow.width = para->GetSpaceAbove();
@@ -226,35 +228,32 @@
return sizeAboveBelow;
}
-void CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF* pRect) {
- if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) {
- CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget);
- if (!pWidget || !pParams || !m_pTextOut)
- return;
+void CXFA_FWLTheme::CalcTextRect(const CFWL_ThemeText& pParams,
+ CFX_RectF* pRect) {
+ if (!m_pTextOut)
+ return;
+ CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams.m_pWidget);
+ if (!pWidget)
+ return;
+
+ if (pParams.m_pWidget->GetClassID() == FWL_Type::MonthCalendar) {
m_pTextOut->SetFont(m_pCalendarFont);
m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize);
m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
- m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
- m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
- m_pTextOut->CalcLogicSize(pParams->m_wsText, pRect);
+ m_pTextOut->SetAlignment(pParams.m_iTTOAlign);
+ m_pTextOut->SetStyles(pParams.m_dwTTOStyles);
+ m_pTextOut->CalcLogicSize(pParams.m_wsText, pRect);
return;
}
- CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget);
- if (!pWidget)
- return;
-
CXFA_Node* pNode = pWidget->GetNode();
m_pTextOut->SetFont(pNode->GetFDEFont(pWidget->GetDoc()));
m_pTextOut->SetFontSize(pNode->GetFontSize());
m_pTextOut->SetTextColor(pNode->GetTextColor());
- if (!pParams)
- return;
-
- m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
- m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
- m_pTextOut->CalcLogicSize(pParams->m_wsText, pRect);
+ m_pTextOut->SetAlignment(pParams.m_iTTOAlign);
+ m_pTextOut->SetStyles(pParams.m_dwTTOStyles);
+ m_pTextOut->CalcLogicSize(pParams.m_wsText, pRect);
}
CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(CFWL_Widget* pWidget) const {
diff --git a/xfa/fxfa/cxfa_fwltheme.h b/xfa/fxfa/cxfa_fwltheme.h
index 31e29bf..c52e962 100644
--- a/xfa/fxfa/cxfa_fwltheme.h
+++ b/xfa/fxfa/cxfa_fwltheme.h
@@ -32,18 +32,19 @@
bool LoadCalendarFont(CXFA_FFDoc* doc);
// IFWL_ThemeProvider:
- void DrawBackground(CFWL_ThemeBackground* pParams) override;
- void DrawText(CFWL_ThemeText* pParams) override;
- void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF* pRect) override;
+ void DrawBackground(const CFWL_ThemeBackground& pParams) override;
+ void DrawText(const CFWL_ThemeText& pParams) override;
+ void CalcTextRect(const CFWL_ThemeText& pParams, CFX_RectF* pRect) override;
float GetCXBorderSize() const override;
float GetCYBorderSize() const override;
- CFX_RectF GetUIMargin(CFWL_ThemePart* pThemePart) const override;
- float GetFontSize(CFWL_ThemePart* pThemePart) const override;
- RetainPtr<CFGAS_GEFont> GetFont(CFWL_ThemePart* pThemePart) const override;
- float GetLineHeight(CFWL_ThemePart* pThemePart) const override;
+ CFX_RectF GetUIMargin(const CFWL_ThemePart& pThemePart) const override;
+ float GetFontSize(const CFWL_ThemePart& pThemePart) const override;
+ RetainPtr<CFGAS_GEFont> GetFont(
+ const CFWL_ThemePart& pThemePart) const override;
+ float GetLineHeight(const CFWL_ThemePart& pThemePart) const override;
float GetScrollBarWidth() const override;
- FX_COLORREF GetTextColor(CFWL_ThemePart* pThemePart) const override;
- CFX_SizeF GetSpaceAboveBelow(CFWL_ThemePart* pThemePart) const override;
+ FX_COLORREF GetTextColor(const CFWL_ThemePart& pThemePart) const override;
+ CFX_SizeF GetSpaceAboveBelow(const CFWL_ThemePart& pThemePart) const override;
private:
CFWL_WidgetTP* GetTheme(CFWL_Widget* pWidget) const;