Begin encapsulation of CFWL_ThemePart classes -- Add .cpp file for CFWL_ThemeBackground constructors. -- Avoid multiplication against identity matrix. -- Remove redundant assignments of CFWL_PartState_Normal Bug: pdfium:1680 Change-Id: Ia584e605440397d60161c3c15153e95ca7359b83 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/80130 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fwl/BUILD.gn b/xfa/fwl/BUILD.gn index 511a29c..0b02bf2 100644 --- a/xfa/fwl/BUILD.gn +++ b/xfa/fwl/BUILD.gn
@@ -65,6 +65,7 @@ "cfwl_pushbutton.h", "cfwl_scrollbar.cpp", "cfwl_scrollbar.h", + "cfwl_themebackground.cpp", "cfwl_themebackground.h", "cfwl_themepart.cpp", "cfwl_themepart.h",
diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp index 44ce6a0..09065e9 100644 --- a/xfa/fwl/cfwl_barcode.cpp +++ b/xfa/fwl/cfwl_barcode.cpp
@@ -156,8 +156,7 @@ return; IFWL_ThemeProvider* pTheme = GetThemeProvider(); - CFWL_ThemePart part; - part.m_pWidget = this; + CFWL_ThemePart part(this); if (RetainPtr<CFGAS_GEFont> pFont = pTheme->GetFont(part)) { if (CFX_Font* pCXFont = pFont->GetDevFont()) m_pBarcodeEngine->SetFont(pCXFont);
diff --git a/xfa/fwl/cfwl_caret.cpp b/xfa/fwl/cfwl_caret.cpp index db82ac8..2788bfa 100644 --- a/xfa/fwl/cfwl_caret.cpp +++ b/xfa/fwl/cfwl_caret.cpp
@@ -62,13 +62,11 @@ if (!(m_Properties.m_dwStates & kStateHighlight)) return; - CFWL_ThemeBackground param; - param.m_pWidget = this; - param.m_pGraphics = pGraphics; + CFWL_ThemeBackground param(this, pGraphics); param.m_PartRect = CFX_RectF(0, 0, GetWidgetRect().Size()); param.m_iPart = CFWL_Part::Background; param.m_dwStates = CFWL_PartState_HightLight; - param.m_matrix.Concat(mtMatrix); + param.m_matrix = mtMatrix; GetThemeProvider()->DrawBackground(param); }
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp index 01160b6..3d7c95d 100644 --- a/xfa/fwl/cfwl_checkbox.cpp +++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -59,12 +59,10 @@ DrawBorder(pGraphics, CFWL_Part::Border, matrix); int32_t dwStates = GetPartStates(); - CFWL_ThemeBackground param; - param.m_pWidget = this; + CFWL_ThemeBackground param(this, pGraphics); param.m_iPart = CFWL_Part::Background; param.m_dwStates = dwStates; - param.m_pGraphics = pGraphics; - param.m_matrix.Concat(matrix); + param.m_matrix = matrix; param.m_PartRect = m_ClientRect; if (m_Properties.m_dwStates & FWL_WGTSTATE_Focused) param.m_pRtData = &m_FocusRect; @@ -76,12 +74,10 @@ param.m_PartRect = m_BoxRect; pTheme->DrawBackground(param); - CFWL_ThemeText textParam; - textParam.m_pWidget = this; + CFWL_ThemeText textParam(this, pGraphics); textParam.m_iPart = CFWL_Part::Caption; textParam.m_dwStates = dwStates; - textParam.m_pGraphics = pGraphics; - textParam.m_matrix.Concat(matrix); + textParam.m_matrix = matrix; textParam.m_PartRect = m_CaptionRect; textParam.m_wsText = L"Check box"; textParam.m_dwTTOStyles = m_TTOStyles;
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp index e9a81ef..c2977c4 100644 --- a/xfa/fwl/cfwl_combobox.cpp +++ b/xfa/fwl/cfwl_combobox.cpp
@@ -106,11 +106,9 @@ pGraphics->SaveGraphState(); pGraphics->ConcatMatrix(matrix); if (!m_BtnRect.IsEmpty(0.1f)) { - CFWL_ThemeBackground param; - param.m_pWidget = this; + CFWL_ThemeBackground param(this, pGraphics); param.m_iPart = CFWL_Part::DropDownButton; param.m_dwStates = m_iBtnState; - param.m_pGraphics = pGraphics; param.m_PartRect = m_BtnRect; GetThemeProvider()->DrawBackground(param); } @@ -282,8 +280,7 @@ fBtn - borderWidth, m_ClientRect.height - 2 * borderWidth); } - CFWL_ThemePart part; - part.m_pWidget = this; + CFWL_ThemePart part(this); CFX_RectF pUIMargin = theme->GetUIMargin(part); m_ContentRect.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width, pUIMargin.height);
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp index ec3af04..9108539 100644 --- a/xfa/fwl/cfwl_datetimepicker.cpp +++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -181,13 +181,11 @@ void CFWL_DateTimePicker::DrawDropDownButton(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeBackground param; - param.m_pWidget = this; + CFWL_ThemeBackground param(this, pGraphics); param.m_iPart = CFWL_Part::DropDownButton; param.m_dwStates = m_iBtnState; - param.m_pGraphics = pGraphics; param.m_PartRect = m_BtnRect; - param.m_matrix.Concat(mtMatrix); + param.m_matrix = mtMatrix; GetThemeProvider()->DrawBackground(param); }
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index 76eb9ba..d14e515 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp
@@ -352,10 +352,8 @@ } pGraphics->SetClipRect(rtClip); - CFWL_ThemeBackground param; - param.m_pGraphics = pGraphics; + CFWL_ThemeBackground param(this, pGraphics); param.m_matrix = mtMatrix; - param.m_pWidget = this; param.m_iPart = CFWL_Part::Background; param.m_pPath = &path; GetThemeProvider()->DrawBackground(param); @@ -377,10 +375,8 @@ CFX_PointF(fLeft, m_ClientRect.bottom())); } - CFWL_ThemeBackground param; - param.m_pGraphics = pGraphics; + CFWL_ThemeBackground param(this, pGraphics); param.m_matrix = mtMatrix; - param.m_pWidget = this; param.m_iPart = CFWL_Part::CombTextLine; param.m_pPath = &path; GetThemeProvider()->DrawBackground(param); @@ -480,8 +476,7 @@ m_pEditEngine->LimitHorizontalScroll(!auto_hscroll); IFWL_ThemeProvider* theme = GetThemeProvider(); - CFWL_ThemePart part; - part.m_pWidget = this; + CFWL_ThemePart part(this); m_fFontSize = theme->GetFontSize(part); RetainPtr<CFGAS_GEFont> pFont = theme->GetFont(part); @@ -552,16 +547,11 @@ } void CFWL_Edit::UpdateVAlignment() { - float fSpaceAbove = 0.0f; - float fSpaceBelow = 0.0f; IFWL_ThemeProvider* theme = GetThemeProvider(); - CFWL_ThemePart part; - part.m_pWidget = this; - - CFX_SizeF pSpace = theme->GetSpaceAboveBelow(part); - fSpaceAbove = pSpace.width >= 0.1f ? pSpace.width : 0.0f; - fSpaceBelow = pSpace.height >= 0.1f ? pSpace.height : 0.0f; - + CFWL_ThemePart part(this); + const CFX_SizeF pSpace = theme->GetSpaceAboveBelow(part); + const float fSpaceAbove = pSpace.width >= 0.1f ? pSpace.width : 0.0f; + const float fSpaceBelow = pSpace.height >= 0.1f ? pSpace.height : 0.0f; float fOffsetY = 0.0f; CFX_RectF contents_bounds = m_pEditEngine->GetContentsBoundingBox(); if (m_Properties.m_dwStyleExes & FWL_STYLEEXT_EDT_VCenter) { @@ -691,14 +681,13 @@ IFWL_ThemeProvider* theme = GetThemeProvider(); float fWidth = theme->GetScrollBarWidth(); - CFWL_ThemePart part; if (!GetOuter()) { - part.m_pWidget = this; + CFWL_ThemePart part(this); CFX_RectF pUIMargin = theme->GetUIMargin(part); m_EngineRect.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width, pUIMargin.height); } else if (GetOuter()->GetClassID() == FWL_Type::DateTimePicker) { - part.m_pWidget = GetOuter(); + CFWL_ThemePart part(GetOuter()); CFX_RectF pUIMargin = theme->GetUIMargin(part); m_EngineRect.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width, pUIMargin.height);
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp index a0d925e..e93babd 100644 --- a/xfa/fwl/cfwl_listbox.cpp +++ b/xfa/fwl/cfwl_listbox.cpp
@@ -332,12 +332,9 @@ if (!pGraphics) return; - CFWL_ThemeBackground param; - param.m_pWidget = this; + CFWL_ThemeBackground param(this, pGraphics); param.m_iPart = CFWL_Part::Background; - param.m_dwStates = 0; - param.m_pGraphics = pGraphics; - param.m_matrix.Concat(mtMatrix); + param.m_matrix = mtMatrix; param.m_PartRect = m_ClientRect; if (IsShowScrollBar(false) && IsShowScrollBar(true)) param.m_pRtData = &m_StaticRect; @@ -396,12 +393,10 @@ } CFX_RectF rtFocus(rtItem); // Must outlive |bg_param|. - CFWL_ThemeBackground bg_param; - bg_param.m_pWidget = this; + CFWL_ThemeBackground bg_param(this, pGraphics); bg_param.m_iPart = CFWL_Part::ListItem; bg_param.m_dwStates = dwPartStates; - bg_param.m_pGraphics = pGraphics; - bg_param.m_matrix.Concat(mtMatrix); + bg_param.m_matrix = mtMatrix; bg_param.m_PartRect = rtItem; bg_param.m_bMaximize = true; bg_param.m_pRtData = &rtFocus; @@ -424,12 +419,10 @@ CFX_RectF rtText(rtItem); rtText.Deflate(kItemTextMargin, kItemTextMargin); - CFWL_ThemeText textParam; - textParam.m_pWidget = this; + CFWL_ThemeText textParam(this, pGraphics); textParam.m_iPart = CFWL_Part::ListItem; textParam.m_dwStates = dwPartStates; - textParam.m_pGraphics = pGraphics; - textParam.m_matrix.Concat(mtMatrix); + textParam.m_matrix = mtMatrix; textParam.m_PartRect = rtText; textParam.m_wsText = std::move(wsText); textParam.m_dwTTOStyles = m_TTOStyles; @@ -443,8 +436,7 @@ m_ContentRect = m_ClientRect; CFX_RectF rtUIMargin; if (!GetOuter()) { - CFWL_ThemePart part; - part.m_pWidget = this; + CFWL_ThemePart part(this); CFX_RectF pUIMargin = GetThemeProvider()->GetUIMargin(part); m_ContentRect.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width, pUIMargin.height); @@ -580,8 +572,7 @@ } float CFWL_ListBox::CalcItemHeight() { - CFWL_ThemePart part; - part.m_pWidget = this; + CFWL_ThemePart part(this); return GetThemeProvider()->GetFontSize(part) + 2 * kItemTextMargin; }
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp index 3e69428..d3ccb1a 100644 --- a/xfa/fwl/cfwl_monthcalendar.cpp +++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -150,88 +150,70 @@ void CFWL_MonthCalendar::DrawBackground(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeBackground params; - params.m_pWidget = this; + CFWL_ThemeBackground params(this, pGraphics); params.m_iPart = CFWL_Part::Background; - params.m_pGraphics = pGraphics; - params.m_dwStates = CFWL_PartState_Normal; params.m_PartRect = m_ClientRect; - params.m_matrix.Concat(mtMatrix); + params.m_matrix = mtMatrix; GetThemeProvider()->DrawBackground(params); } void CFWL_MonthCalendar::DrawHeadBK(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeBackground params; - params.m_pWidget = this; + CFWL_ThemeBackground params(this, pGraphics); params.m_iPart = CFWL_Part::Header; - params.m_pGraphics = pGraphics; - params.m_dwStates = CFWL_PartState_Normal; params.m_PartRect = m_HeadRect; - params.m_matrix.Concat(mtMatrix); + params.m_matrix = mtMatrix; GetThemeProvider()->DrawBackground(params); } void CFWL_MonthCalendar::DrawLButton(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeBackground params; - params.m_pWidget = this; + CFWL_ThemeBackground params(this, pGraphics); params.m_iPart = CFWL_Part::LBtn; - params.m_pGraphics = pGraphics; params.m_dwStates = m_iLBtnPartStates; params.m_PartRect = m_LBtnRect; - params.m_matrix.Concat(mtMatrix); + params.m_matrix = mtMatrix; GetThemeProvider()->DrawBackground(params); } void CFWL_MonthCalendar::DrawRButton(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeBackground params; - params.m_pWidget = this; + CFWL_ThemeBackground params(this, pGraphics); params.m_iPart = CFWL_Part::RBtn; - params.m_pGraphics = pGraphics; params.m_dwStates = m_iRBtnPartStates; params.m_PartRect = m_RBtnRect; - params.m_matrix.Concat(mtMatrix); + params.m_matrix = mtMatrix; GetThemeProvider()->DrawBackground(params); } void CFWL_MonthCalendar::DrawCaption(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeText textParam; - textParam.m_pWidget = this; + CFWL_ThemeText textParam(this, pGraphics); textParam.m_iPart = CFWL_Part::Caption; - textParam.m_dwStates = CFWL_PartState_Normal; - textParam.m_pGraphics = pGraphics; textParam.m_wsText = GetHeadText(m_iCurYear, m_iCurMonth); m_HeadSize = CalcTextSize(textParam.m_wsText, false); CalcHeadSize(); textParam.m_PartRect = m_HeadTextRect; textParam.m_dwTTOStyles.single_line_ = true; textParam.m_iTTOAlign = FDE_TextAlignment::kCenter; - textParam.m_matrix.Concat(mtMatrix); + textParam.m_matrix = mtMatrix; GetThemeProvider()->DrawText(textParam); } void CFWL_MonthCalendar::DrawSeparator(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeBackground params; - params.m_pWidget = this; + CFWL_ThemeBackground params(this, pGraphics); params.m_iPart = CFWL_Part::HSeparator; - params.m_pGraphics = pGraphics; - params.m_dwStates = CFWL_PartState_Normal; params.m_PartRect = m_HSepRect; - params.m_matrix.Concat(mtMatrix); + params.m_matrix = mtMatrix; GetThemeProvider()->DrawBackground(params); } void CFWL_MonthCalendar::DrawDatesInBK(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeBackground params; - params.m_pWidget = this; + CFWL_ThemeBackground params(this, pGraphics); params.m_iPart = CFWL_Part::DateInBK; - params.m_pGraphics = pGraphics; - params.m_matrix.Concat(mtMatrix); + params.m_matrix = mtMatrix; IFWL_ThemeProvider* pTheme = GetThemeProvider(); int32_t iCount = pdfium::CollectionSize<int32_t>(m_DateArray); @@ -256,14 +238,11 @@ void CFWL_MonthCalendar::DrawWeek(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeText params; - params.m_pWidget = this; + CFWL_ThemeText params(this, pGraphics); params.m_iPart = CFWL_Part::Week; - params.m_pGraphics = pGraphics; - params.m_dwStates = CFWL_PartState_Normal; params.m_iTTOAlign = FDE_TextAlignment::kCenter; params.m_dwTTOStyles.single_line_ = true; - params.m_matrix.Concat(mtMatrix); + params.m_matrix = mtMatrix; IFWL_ThemeProvider* pTheme = GetThemeProvider(); CFX_RectF rtDayOfWeek; @@ -280,30 +259,24 @@ void CFWL_MonthCalendar::DrawToday(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeText params; - params.m_pWidget = this; + CFWL_ThemeText params(this, pGraphics); params.m_iPart = CFWL_Part::Today; - params.m_pGraphics = pGraphics; - params.m_dwStates = CFWL_PartState_Normal; params.m_iTTOAlign = FDE_TextAlignment::kCenterLeft; params.m_wsText = GetTodayText(m_iYear, m_iMonth, m_iDay); m_TodaySize = CalcTextSize(params.m_wsText, false); CalcTodaySize(); params.m_PartRect = m_TodayRect; params.m_dwTTOStyles.single_line_ = true; - params.m_matrix.Concat(mtMatrix); + params.m_matrix = mtMatrix; GetThemeProvider()->DrawText(params); } void CFWL_MonthCalendar::DrawDatesIn(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeText params; - params.m_pWidget = this; + CFWL_ThemeText params(this, pGraphics); params.m_iPart = CFWL_Part::DatesIn; - params.m_pGraphics = pGraphics; - params.m_dwStates = CFWL_PartState_Normal; params.m_iTTOAlign = FDE_TextAlignment::kCenter; - params.m_matrix.Concat(mtMatrix); + params.m_matrix = mtMatrix; IFWL_ThemeProvider* pTheme = GetThemeProvider(); int32_t iCount = pdfium::CollectionSize<int32_t>(m_DateArray); @@ -322,13 +295,10 @@ void CFWL_MonthCalendar::DrawDatesOut(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeText params; - params.m_pWidget = this; + CFWL_ThemeText params(this, pGraphics); params.m_iPart = CFWL_Part::DatesOut; - params.m_pGraphics = pGraphics; - params.m_dwStates = CFWL_PartState_Normal; params.m_iTTOAlign = FDE_TextAlignment::kCenter; - params.m_matrix.Concat(mtMatrix); + params.m_matrix = mtMatrix; GetThemeProvider()->DrawText(params); } @@ -344,13 +314,10 @@ if (!pDate) return; - CFWL_ThemeBackground params; - params.m_pWidget = this; + CFWL_ThemeBackground params(this, pGraphics); params.m_iPart = CFWL_Part::DateInCircle; - params.m_pGraphics = pGraphics; params.m_PartRect = pDate->rect; - params.m_dwStates = CFWL_PartState_Normal; - params.m_matrix.Concat(mtMatrix); + params.m_matrix = mtMatrix; GetThemeProvider()->DrawBackground(params); }
diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp index 7e57c58..0b502f3 100644 --- a/xfa/fwl/cfwl_pushbutton.cpp +++ b/xfa/fwl/cfwl_pushbutton.cpp
@@ -55,12 +55,10 @@ void CFWL_PushButton::DrawBkground(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& matrix) { - CFWL_ThemeBackground param; - param.m_pWidget = this; + CFWL_ThemeBackground param(this, pGraphics); param.m_iPart = CFWL_Part::Background; param.m_dwStates = GetPartStates(); - param.m_pGraphics = pGraphics; - param.m_matrix.Concat(matrix); + param.m_matrix = matrix; param.m_PartRect = m_ClientRect; if (m_Properties.m_dwStates & FWL_WGTSTATE_Focused) param.m_pRtData = &m_CaptionRect;
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp index fd8ad7a..7b61342 100644 --- a/xfa/fwl/cfwl_scrollbar.cpp +++ b/xfa/fwl/cfwl_scrollbar.cpp
@@ -76,14 +76,12 @@ void CFWL_ScrollBar::DrawTrack(CFGAS_GEGraphics* pGraphics, bool bLower, const CFX_Matrix& mtMatrix) { - CFWL_ThemeBackground param; - param.m_pWidget = this; + CFWL_ThemeBackground param(this, pGraphics); param.m_iPart = bLower ? CFWL_Part::LowerTrack : CFWL_Part::UpperTrack; param.m_dwStates = (m_Properties.m_dwStates & FWL_WGTSTATE_Disabled) ? CFWL_PartState_Disabled : (bLower ? m_iMinTrackState : m_iMaxTrackState); - param.m_pGraphics = pGraphics; - param.m_matrix.Concat(mtMatrix); + param.m_matrix = mtMatrix; param.m_PartRect = bLower ? m_MinTrackRect : m_MaxTrackRect; GetThemeProvider()->DrawBackground(param); } @@ -91,14 +89,12 @@ void CFWL_ScrollBar::DrawArrowBtn(CFGAS_GEGraphics* pGraphics, bool bMinBtn, const CFX_Matrix& mtMatrix) { - CFWL_ThemeBackground param; - param.m_pWidget = this; + CFWL_ThemeBackground param(this, pGraphics); param.m_iPart = bMinBtn ? CFWL_Part::ForeArrow : CFWL_Part::BackArrow; param.m_dwStates = (m_Properties.m_dwStates & FWL_WGTSTATE_Disabled) ? CFWL_PartState_Disabled : (bMinBtn ? m_iMinButtonState : m_iMaxButtonState); - param.m_pGraphics = pGraphics; - param.m_matrix.Concat(mtMatrix); + param.m_matrix = mtMatrix; param.m_PartRect = bMinBtn ? m_MinBtnRect : m_MaxBtnRect; if (param.m_PartRect.height > 0 && param.m_PartRect.width > 0) GetThemeProvider()->DrawBackground(param); @@ -106,14 +102,12 @@ void CFWL_ScrollBar::DrawThumb(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix) { - CFWL_ThemeBackground param; - param.m_pWidget = this; + CFWL_ThemeBackground param(this, pGraphics); param.m_iPart = CFWL_Part::Thumb; param.m_dwStates = (m_Properties.m_dwStates & FWL_WGTSTATE_Disabled) ? CFWL_PartState_Disabled : m_iThumbButtonState; - param.m_pGraphics = pGraphics; - param.m_matrix.Concat(mtMatrix); + param.m_matrix = mtMatrix; param.m_PartRect = m_ThumbRect; GetThemeProvider()->DrawBackground(param); }
diff --git a/xfa/fwl/cfwl_themebackground.cpp b/xfa/fwl/cfwl_themebackground.cpp new file mode 100644 index 0000000..54d5cb9 --- /dev/null +++ b/xfa/fwl/cfwl_themebackground.cpp
@@ -0,0 +1,13 @@ +// Copyright 2021 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "xfa/fwl/cfwl_themebackground.h" + +CFWL_ThemeBackground::CFWL_ThemeBackground(CFWL_Widget* pWidget, + CFGAS_GEGraphics* pGraphics) + : CFWL_ThemePart(pWidget), m_pGraphics(pGraphics) {} + +CFWL_ThemeBackground::~CFWL_ThemeBackground() = default;
diff --git a/xfa/fwl/cfwl_themebackground.h b/xfa/fwl/cfwl_themebackground.h index 8751e3c..56c2972 100644 --- a/xfa/fwl/cfwl_themebackground.h +++ b/xfa/fwl/cfwl_themebackground.h
@@ -15,15 +15,15 @@ class CFWL_ThemeBackground final : public CFWL_ThemePart { public: - CFWL_ThemeBackground(); + CFWL_ThemeBackground(CFWL_Widget* pWidget, CFGAS_GEGraphics* pGraphics); ~CFWL_ThemeBackground(); - UnownedPtr<CFGAS_GEGraphics> m_pGraphics; + CFGAS_GEGraphics* GetGraphics() const { return m_pGraphics.Get(); } + UnownedPtr<const CFGAS_GEPath> m_pPath; + + private: + UnownedPtr<CFGAS_GEGraphics> const m_pGraphics; }; -inline CFWL_ThemeBackground::CFWL_ThemeBackground() = default; - -inline CFWL_ThemeBackground::~CFWL_ThemeBackground() = default; - #endif // XFA_FWL_CFWL_THEMEBACKGROUND_H_
diff --git a/xfa/fwl/cfwl_themepart.cpp b/xfa/fwl/cfwl_themepart.cpp index f488f2f..f7d5974 100644 --- a/xfa/fwl/cfwl_themepart.cpp +++ b/xfa/fwl/cfwl_themepart.cpp
@@ -6,6 +6,6 @@ #include "xfa/fwl/cfwl_themepart.h" -CFWL_ThemePart::CFWL_ThemePart() = default; +CFWL_ThemePart::CFWL_ThemePart(CFWL_Widget* pWidget) : m_pWidget(pWidget) {} CFWL_ThemePart::~CFWL_ThemePart() = default;
diff --git a/xfa/fwl/cfwl_themepart.h b/xfa/fwl/cfwl_themepart.h index 73d10a9..76abbca 100644 --- a/xfa/fwl/cfwl_themepart.h +++ b/xfa/fwl/cfwl_themepart.h
@@ -79,17 +79,21 @@ class CFWL_ThemePart { public: - CFWL_ThemePart(); + CFWL_ThemePart(CFWL_Widget* pWidget); ~CFWL_ThemePart(); + CFWL_Widget* GetWidget() const { return m_pWidget.Get(); } + CFX_Matrix m_matrix; CFX_RectF m_PartRect; - UnownedPtr<CFWL_Widget> m_pWidget; UnownedPtr<const CFX_RectF> m_pRtData; uint32_t m_dwStates = CFWL_PartState_Normal; CFWL_Part m_iPart = CFWL_Part::None; bool m_bMaximize = false; bool m_bStaticBackground = false; + + private: + UnownedPtr<CFWL_Widget> const m_pWidget; }; #endif // XFA_FWL_CFWL_THEMEPART_H_
diff --git a/xfa/fwl/cfwl_themetext.cpp b/xfa/fwl/cfwl_themetext.cpp index 2cd07d0..7349aa8 100644 --- a/xfa/fwl/cfwl_themetext.cpp +++ b/xfa/fwl/cfwl_themetext.cpp
@@ -6,6 +6,8 @@ #include "xfa/fwl/cfwl_themetext.h" -CFWL_ThemeText::CFWL_ThemeText() = default; +CFWL_ThemeText::CFWL_ThemeText(CFWL_Widget* pWidget, + CFGAS_GEGraphics* pGraphics) + : CFWL_ThemePart(pWidget), m_pGraphics(pGraphics) {} CFWL_ThemeText::~CFWL_ThemeText() = default;
diff --git a/xfa/fwl/cfwl_themetext.h b/xfa/fwl/cfwl_themetext.h index ae924ed..bd47392 100644 --- a/xfa/fwl/cfwl_themetext.h +++ b/xfa/fwl/cfwl_themetext.h
@@ -16,13 +16,17 @@ class CFWL_ThemeText final : public CFWL_ThemePart { public: - CFWL_ThemeText(); + CFWL_ThemeText(CFWL_Widget* pWidget, CFGAS_GEGraphics* pGraphics); ~CFWL_ThemeText(); + CFGAS_GEGraphics* GetGraphics() const { return m_pGraphics.Get(); } + FDE_TextAlignment m_iTTOAlign = FDE_TextAlignment::kTopLeft; FDE_TextStyle m_dwTTOStyles; - UnownedPtr<CFGAS_GEGraphics> m_pGraphics; WideString m_wsText; + + private: + UnownedPtr<CFGAS_GEGraphics> const m_pGraphics; }; #endif // XFA_FWL_CFWL_THEMETEXT_H_
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp index ff783ae..15c1e47 100644 --- a/xfa/fwl/cfwl_widget.cpp +++ b/xfa/fwl/cfwl_widget.cpp
@@ -225,8 +225,7 @@ } CFX_SizeF CFWL_Widget::CalcTextSize(const WideString& wsText, bool bMultiLine) { - CFWL_ThemeText calPart; - calPart.m_pWidget = this; + CFWL_ThemeText calPart(this, nullptr); calPart.m_wsText = wsText; if (bMultiLine) calPart.m_dwTTOStyles.line_wrap_ = true; @@ -244,8 +243,7 @@ const FDE_TextStyle& dwTTOStyles, FDE_TextAlignment iTTOAlign, CFX_RectF* pRect) { - CFWL_ThemeText calPart; - calPart.m_pWidget = this; + CFWL_ThemeText calPart(this, nullptr); calPart.m_wsText = wsText; calPart.m_dwTTOStyles = dwTTOStyles; calPart.m_iTTOAlign = iTTOAlign; @@ -283,10 +281,8 @@ void CFWL_Widget::DrawBackground(CFGAS_GEGraphics* pGraphics, CFWL_Part iPartBk, const CFX_Matrix& mtMatrix) { - CFWL_ThemeBackground param; - param.m_pWidget = this; + CFWL_ThemeBackground param(this, pGraphics); param.m_iPart = iPartBk; - param.m_pGraphics = pGraphics; param.m_matrix = mtMatrix; param.m_PartRect = GetRelativeRect(); GetThemeProvider()->DrawBackground(param); @@ -295,10 +291,8 @@ void CFWL_Widget::DrawBorder(CFGAS_GEGraphics* pGraphics, CFWL_Part iPartBorder, const CFX_Matrix& matrix) { - CFWL_ThemeBackground param; - param.m_pWidget = this; + CFWL_ThemeBackground param(this, pGraphics); param.m_iPart = iPartBorder; - param.m_pGraphics = pGraphics; param.m_matrix = matrix; param.m_PartRect = GetRelativeRect(); GetThemeProvider()->DrawBackground(param);
diff --git a/xfa/fwl/theme/cfwl_barcodetp.cpp b/xfa/fwl/theme/cfwl_barcodetp.cpp index b6d147d..ffe87d4 100644 --- a/xfa/fwl/theme/cfwl_barcodetp.cpp +++ b/xfa/fwl/theme/cfwl_barcodetp.cpp
@@ -17,11 +17,10 @@ void CFWL_BarcodeTP::DrawBackground(const CFWL_ThemeBackground& pParams) { switch (pParams.m_iPart) { case CFWL_Part::Border: - DrawBorder(pParams.m_pGraphics.Get(), pParams.m_PartRect, - pParams.m_matrix); + DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix); break; case CFWL_Part::Background: - FillBackground(pParams.m_pGraphics.Get(), pParams.m_PartRect, + FillBackground(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix); break; default:
diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp index 30663c9..91ce1f8 100644 --- a/xfa/fwl/theme/cfwl_carettp.cpp +++ b/xfa/fwl/theme/cfwl_carettp.cpp
@@ -22,8 +22,8 @@ if (!(pParams.m_dwStates & CFWL_PartState_HightLight)) return; - DrawCaretBK(pParams.m_pGraphics.Get(), pParams.m_dwStates, - pParams.m_PartRect, pParams.m_matrix); + DrawCaretBK(pParams.GetGraphics(), pParams.m_dwStates, pParams.m_PartRect, + pParams.m_matrix); break; } default:
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index 10dd265..7183ba6 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -210,7 +210,7 @@ if ((pParams.m_dwStates & CFWL_PartState_Checked) || (pParams.m_dwStates & CFWL_PartState_Neutral)) { - DrawCheckSign(pParams.m_pWidget, pParams.m_pGraphics.Get(), + DrawCheckSign(pParams.GetWidget(), pParams.GetGraphics(), pParams.m_PartRect, pParams.m_dwStates, pParams.m_matrix); } }
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp index f7ef5b5..a143f13 100644 --- a/xfa/fwl/theme/cfwl_comboboxtp.cpp +++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp
@@ -20,8 +20,7 @@ void CFWL_ComboBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) { switch (pParams.m_iPart) { case CFWL_Part::Border: { - DrawBorder(pParams.m_pGraphics.Get(), pParams.m_PartRect, - pParams.m_matrix); + DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix); break; } case CFWL_Part::Background: { @@ -39,11 +38,11 @@ default: argb_color = 0xFFFFFFFF; } - pParams.m_pGraphics->SaveGraphState(); - pParams.m_pGraphics->SetFillColor(CFGAS_GEColor(argb_color)); - pParams.m_pGraphics->FillPath( + pParams.GetGraphics()->SaveGraphState(); + pParams.GetGraphics()->SetFillColor(CFGAS_GEColor(argb_color)); + pParams.GetGraphics()->FillPath( path, CFX_FillRenderOptions::FillType::kWinding, pParams.m_matrix); - pParams.m_pGraphics->RestoreGraphState(); + pParams.GetGraphics()->RestoreGraphState(); break; } case CFWL_Part::DropDownButton: { @@ -79,6 +78,6 @@ default: break; } - DrawArrowBtn(pParams.m_pGraphics.Get(), pParams.m_PartRect, + DrawArrowBtn(pParams.GetGraphics(), pParams.m_PartRect, FWLTHEME_DIRECTION_Down, eState, pParams.m_matrix); }
diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.cpp b/xfa/fwl/theme/cfwl_datetimepickertp.cpp index a2bb19e..70d3db4 100644 --- a/xfa/fwl/theme/cfwl_datetimepickertp.cpp +++ b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
@@ -17,8 +17,7 @@ const CFWL_ThemeBackground& pParams) { switch (pParams.m_iPart) { case CFWL_Part::Border: - DrawBorder(pParams.m_pGraphics.Get(), pParams.m_PartRect, - pParams.m_matrix); + DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix); break; case CFWL_Part::DropDownButton: DrawDropDownButton(pParams, pParams.m_matrix); @@ -54,6 +53,6 @@ default: break; } - DrawArrowBtn(pParams.m_pGraphics.Get(), pParams.m_PartRect, + DrawArrowBtn(pParams.GetGraphics(), pParams.m_PartRect, FWLTHEME_DIRECTION_Down, eState, matrix); }
diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp index 36cff36..4f05d19 100644 --- a/xfa/fwl/theme/cfwl_edittp.cpp +++ b/xfa/fwl/theme/cfwl_edittp.cpp
@@ -19,13 +19,12 @@ void CFWL_EditTP::DrawBackground(const CFWL_ThemeBackground& pParams) { switch (pParams.m_iPart) { case CFWL_Part::Border: { - DrawBorder(pParams.m_pGraphics.Get(), pParams.m_PartRect, - pParams.m_matrix); + DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix); break; } case CFWL_Part::Background: { if (pParams.m_pPath) { - CFGAS_GEGraphics* pGraphics = pParams.m_pGraphics.Get(); + CFGAS_GEGraphics* pGraphics = pParams.GetGraphics(); pGraphics->SaveGraphState(); pGraphics->SetFillColor(CFGAS_GEColor(FWLTHEME_COLOR_BKSelected)); if (pParams.m_pPath) { @@ -47,24 +46,24 @@ else cr = CFGAS_GEColor(0xFFFFFFFF); } - pParams.m_pGraphics->SaveGraphState(); - pParams.m_pGraphics->SetFillColor(cr); - pParams.m_pGraphics->FillPath( + pParams.GetGraphics()->SaveGraphState(); + pParams.GetGraphics()->SetFillColor(cr); + pParams.GetGraphics()->FillPath( path, CFX_FillRenderOptions::FillType::kWinding, pParams.m_matrix); - pParams.m_pGraphics->RestoreGraphState(); + pParams.GetGraphics()->RestoreGraphState(); } break; } case CFWL_Part::CombTextLine: { CFWL_Widget::AdapterIface* pWidget = - pParams.m_pWidget->GetOutmost()->GetAdapterIface(); + pParams.GetWidget()->GetOutmost()->GetAdapterIface(); FX_ARGB cr = 0xFF000000; float fWidth = 1.0f; pWidget->GetBorderColorAndThickness(&cr, &fWidth); - pParams.m_pGraphics->SetStrokeColor(CFGAS_GEColor(cr)); - pParams.m_pGraphics->SetLineWidth(fWidth); + pParams.GetGraphics()->SetStrokeColor(CFGAS_GEColor(cr)); + pParams.GetGraphics()->SetLineWidth(fWidth); if (pParams.m_pPath) - pParams.m_pGraphics->StrokePath(*pParams.m_pPath, pParams.m_matrix); + pParams.GetGraphics()->StrokePath(*pParams.m_pPath, pParams.m_matrix); break; } default:
diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp index 4712cd7..41cf9d9 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.cpp +++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -20,21 +20,20 @@ void CFWL_ListBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) { switch (pParams.m_iPart) { case CFWL_Part::Border: { - DrawBorder(pParams.m_pGraphics.Get(), pParams.m_PartRect, - pParams.m_matrix); + DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix); break; } case CFWL_Part::Background: { - FillSolidRect(pParams.m_pGraphics.Get(), ArgbEncode(255, 255, 255, 255), + FillSolidRect(pParams.GetGraphics(), ArgbEncode(255, 255, 255, 255), pParams.m_PartRect, pParams.m_matrix); if (pParams.m_pRtData) { - FillSolidRect(pParams.m_pGraphics.Get(), FWLTHEME_COLOR_Background, + FillSolidRect(pParams.GetGraphics(), FWLTHEME_COLOR_Background, *pParams.m_pRtData, pParams.m_matrix); } break; } case CFWL_Part::ListItem: { - DrawListBoxItem(pParams.m_pGraphics.Get(), pParams.m_dwStates, + DrawListBoxItem(pParams.GetGraphics(), pParams.m_dwStates, pParams.m_PartRect, pParams.m_pRtData, pParams.m_matrix); break; } @@ -45,7 +44,7 @@ } else if (pParams.m_dwStates == CFWL_PartState_Normal) { color = 0xFF0000FF; } - FillSolidRect(pParams.m_pGraphics.Get(), color, pParams.m_PartRect, + FillSolidRect(pParams.GetGraphics(), color, pParams.m_PartRect, pParams.m_matrix); break; }
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp index b889be0..c282da6 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp +++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -34,8 +34,7 @@ void CFWL_MonthCalendarTP::DrawBackground(const CFWL_ThemeBackground& pParams) { switch (pParams.m_iPart) { case CFWL_Part::Border: { - DrawBorder(pParams.m_pGraphics.Get(), pParams.m_PartRect, - pParams.m_matrix); + DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix); break; } case CFWL_Part::Background: { @@ -48,13 +47,13 @@ } case CFWL_Part::LBtn: { FWLTHEME_STATE eState = GetState(pParams.m_dwStates); - DrawArrowBtn(pParams.m_pGraphics.Get(), pParams.m_PartRect, + DrawArrowBtn(pParams.GetGraphics(), pParams.m_PartRect, 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_PartRect, + DrawArrowBtn(pParams.GetGraphics(), pParams.m_PartRect, FWLTHEME_DIRECTION_Right, eState, pParams.m_matrix); break; } @@ -103,11 +102,11 @@ CFGAS_GEPath path; CFX_RectF rtTotal(pParams.m_PartRect); path.AddRectangle(rtTotal.left, rtTotal.top, rtTotal.width, rtTotal.height); - pParams.m_pGraphics->SaveGraphState(); - pParams.m_pGraphics->SetFillColor(CFGAS_GEColor(kBackgroundColor)); - pParams.m_pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, - matrix); - pParams.m_pGraphics->RestoreGraphState(); + pParams.GetGraphics()->SaveGraphState(); + pParams.GetGraphics()->SetFillColor(CFGAS_GEColor(kBackgroundColor)); + pParams.GetGraphics()->FillPath( + path, CFX_FillRenderOptions::FillType::kWinding, matrix); + pParams.GetGraphics()->RestoreGraphState(); } void CFWL_MonthCalendarTP::DrawHeadBk(const CFWL_ThemeBackground& pParams, @@ -115,11 +114,11 @@ CFGAS_GEPath path; CFX_RectF rtHead = pParams.m_PartRect; path.AddRectangle(rtHead.left, rtHead.top, rtHead.width, rtHead.height); - pParams.m_pGraphics->SaveGraphState(); - pParams.m_pGraphics->SetFillColor(CFGAS_GEColor(kBackgroundColor)); - pParams.m_pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, - matrix); - pParams.m_pGraphics->RestoreGraphState(); + pParams.GetGraphics()->SaveGraphState(); + pParams.GetGraphics()->SetFillColor(CFGAS_GEColor(kBackgroundColor)); + pParams.GetGraphics()->FillPath( + path, CFX_FillRenderOptions::FillType::kWinding, matrix); + pParams.GetGraphics()->RestoreGraphState(); } void CFWL_MonthCalendarTP::DrawLButton(const CFWL_ThemeBackground& pParams, @@ -127,19 +126,19 @@ CFGAS_GEPath path; CFX_RectF rtLBtn = pParams.m_PartRect; path.AddRectangle(rtLBtn.left, rtLBtn.top, rtLBtn.width, rtLBtn.height); - pParams.m_pGraphics->SaveGraphState(); - pParams.m_pGraphics->SetStrokeColor( + pParams.GetGraphics()->SaveGraphState(); + pParams.GetGraphics()->SetStrokeColor( CFGAS_GEColor(ArgbEncode(0xff, 205, 219, 243))); - pParams.m_pGraphics->StrokePath(path, matrix); + pParams.GetGraphics()->StrokePath(path, matrix); if (pParams.m_dwStates & CFWL_PartState_Pressed) { - pParams.m_pGraphics->SetFillColor( + pParams.GetGraphics()->SetFillColor( CFGAS_GEColor(ArgbEncode(0xff, 174, 198, 242))); - pParams.m_pGraphics->FillPath( + pParams.GetGraphics()->FillPath( path, CFX_FillRenderOptions::FillType::kWinding, matrix); } else { - pParams.m_pGraphics->SetFillColor( + pParams.GetGraphics()->SetFillColor( CFGAS_GEColor(ArgbEncode(0xff, 227, 235, 249))); - pParams.m_pGraphics->FillPath( + pParams.GetGraphics()->FillPath( path, CFX_FillRenderOptions::FillType::kWinding, matrix); } @@ -151,10 +150,10 @@ path.LineTo(CFX_PointF(rtLBtn.left + rtLBtn.Width() / 3 * 2, rtLBtn.bottom() - rtLBtn.height / 4)); - pParams.m_pGraphics->SetStrokeColor( + pParams.GetGraphics()->SetStrokeColor( CFGAS_GEColor(ArgbEncode(0xff, 50, 104, 205))); - pParams.m_pGraphics->StrokePath(path, matrix); - pParams.m_pGraphics->RestoreGraphState(); + pParams.GetGraphics()->StrokePath(path, matrix); + pParams.GetGraphics()->RestoreGraphState(); } void CFWL_MonthCalendarTP::DrawRButton(const CFWL_ThemeBackground& pParams, @@ -162,19 +161,19 @@ CFGAS_GEPath path; CFX_RectF rtRBtn = pParams.m_PartRect; path.AddRectangle(rtRBtn.left, rtRBtn.top, rtRBtn.width, rtRBtn.height); - pParams.m_pGraphics->SaveGraphState(); - pParams.m_pGraphics->SetStrokeColor( + pParams.GetGraphics()->SaveGraphState(); + pParams.GetGraphics()->SetStrokeColor( CFGAS_GEColor(ArgbEncode(0xff, 205, 219, 243))); - pParams.m_pGraphics->StrokePath(path, matrix); + pParams.GetGraphics()->StrokePath(path, matrix); if (pParams.m_dwStates & CFWL_PartState_Pressed) { - pParams.m_pGraphics->SetFillColor( + pParams.GetGraphics()->SetFillColor( CFGAS_GEColor(ArgbEncode(0xff, 174, 198, 242))); - pParams.m_pGraphics->FillPath( + pParams.GetGraphics()->FillPath( path, CFX_FillRenderOptions::FillType::kWinding, matrix); } else { - pParams.m_pGraphics->SetFillColor( + pParams.GetGraphics()->SetFillColor( CFGAS_GEColor(ArgbEncode(0xff, 227, 235, 249))); - pParams.m_pGraphics->FillPath( + pParams.GetGraphics()->FillPath( path, CFX_FillRenderOptions::FillType::kWinding, matrix); } @@ -186,10 +185,10 @@ path.LineTo(CFX_PointF(rtRBtn.left + rtRBtn.Width() / 3, rtRBtn.bottom() - rtRBtn.height / 4)); - pParams.m_pGraphics->SetStrokeColor( + pParams.GetGraphics()->SetStrokeColor( CFGAS_GEColor(ArgbEncode(0xff, 50, 104, 205))); - pParams.m_pGraphics->StrokePath(path, matrix); - pParams.m_pGraphics->RestoreGraphState(); + pParams.GetGraphics()->StrokePath(path, matrix); + pParams.GetGraphics()->RestoreGraphState(); } void CFWL_MonthCalendarTP::DrawHSeparator(const CFWL_ThemeBackground& pParams, @@ -198,10 +197,10 @@ CFX_RectF rtHSep = pParams.m_PartRect; 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(CFGAS_GEColor(kSeparatorColor)); - pParams.m_pGraphics->StrokePath(path, matrix); - pParams.m_pGraphics->RestoreGraphState(); + pParams.GetGraphics()->SaveGraphState(); + pParams.GetGraphics()->SetStrokeColor(CFGAS_GEColor(kSeparatorColor)); + pParams.GetGraphics()->StrokePath(path, matrix); + pParams.GetGraphics()->RestoreGraphState(); } void CFWL_MonthCalendarTP::DrawWeekNumSep(const CFWL_ThemeBackground& pParams, @@ -210,35 +209,35 @@ CFX_RectF rtWeekSep = pParams.m_PartRect; path.MoveTo(rtWeekSep.TopLeft()); path.LineTo(rtWeekSep.BottomLeft()); - pParams.m_pGraphics->SaveGraphState(); - pParams.m_pGraphics->SetStrokeColor(CFGAS_GEColor(kSeparatorColor)); - pParams.m_pGraphics->StrokePath(path, matrix); - pParams.m_pGraphics->RestoreGraphState(); + pParams.GetGraphics()->SaveGraphState(); + pParams.GetGraphics()->SetStrokeColor(CFGAS_GEColor(kSeparatorColor)); + pParams.GetGraphics()->StrokePath(path, matrix); + pParams.GetGraphics()->RestoreGraphState(); } void CFWL_MonthCalendarTP::DrawDatesInBK(const CFWL_ThemeBackground& pParams, const CFX_Matrix& matrix) { - pParams.m_pGraphics->SaveGraphState(); + pParams.GetGraphics()->SaveGraphState(); if (pParams.m_dwStates & CFWL_PartState_Selected) { CFGAS_GEPath path; CFX_RectF rtSelDay = pParams.m_PartRect; path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, rtSelDay.height); - pParams.m_pGraphics->SetFillColor( + pParams.GetGraphics()->SetFillColor( CFGAS_GEColor(kDatesSelectedBackgroundColor)); - pParams.m_pGraphics->FillPath( + pParams.GetGraphics()->FillPath( path, CFX_FillRenderOptions::FillType::kWinding, matrix); } else if (pParams.m_dwStates & CFWL_PartState_Hovered) { CFGAS_GEPath path; CFX_RectF rtSelDay = pParams.m_PartRect; path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, rtSelDay.height); - pParams.m_pGraphics->SetFillColor( + pParams.GetGraphics()->SetFillColor( CFGAS_GEColor(kDatesHoverBackgroundColor)); - pParams.m_pGraphics->FillPath( + pParams.GetGraphics()->FillPath( path, CFX_FillRenderOptions::FillType::kWinding, matrix); } - pParams.m_pGraphics->RestoreGraphState(); + pParams.GetGraphics()->RestoreGraphState(); } void CFWL_MonthCalendarTP::DrawDatesInCircle( @@ -248,10 +247,10 @@ CFX_RectF rtSelDay = pParams.m_PartRect; path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, rtSelDay.height); - pParams.m_pGraphics->SaveGraphState(); - pParams.m_pGraphics->SetStrokeColor(CFGAS_GEColor(kDatesCircleColor)); - pParams.m_pGraphics->StrokePath(path, matrix); - pParams.m_pGraphics->RestoreGraphState(); + pParams.GetGraphics()->SaveGraphState(); + pParams.GetGraphics()->SetStrokeColor(CFGAS_GEColor(kDatesCircleColor)); + pParams.GetGraphics()->StrokePath(path, matrix); + pParams.GetGraphics()->RestoreGraphState(); } void CFWL_MonthCalendarTP::DrawTodayCircle(const CFWL_ThemeBackground& pParams, @@ -260,10 +259,10 @@ CFX_RectF rtTodayCircle = pParams.m_PartRect; path.AddRectangle(rtTodayCircle.left, rtTodayCircle.top, rtTodayCircle.width, rtTodayCircle.height); - pParams.m_pGraphics->SaveGraphState(); - pParams.m_pGraphics->SetStrokeColor(CFGAS_GEColor(kDatesCircleColor)); - pParams.m_pGraphics->StrokePath(path, matrix); - pParams.m_pGraphics->RestoreGraphState(); + pParams.GetGraphics()->SaveGraphState(); + pParams.GetGraphics()->SetStrokeColor(CFGAS_GEColor(kDatesCircleColor)); + pParams.GetGraphics()->StrokePath(path, matrix); + pParams.GetGraphics()->RestoreGraphState(); } FWLTHEME_STATE CFWL_MonthCalendarTP::GetState(uint32_t dwFWLStates) {
diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.cpp b/xfa/fwl/theme/cfwl_pictureboxtp.cpp index 20d18cd..3b0368c 100644 --- a/xfa/fwl/theme/cfwl_pictureboxtp.cpp +++ b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
@@ -17,8 +17,7 @@ void CFWL_PictureBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) { switch (pParams.m_iPart) { case CFWL_Part::Border: - DrawBorder(pParams.m_pGraphics.Get(), pParams.m_PartRect, - pParams.m_matrix); + DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix); break; default: break;
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp index 3e7b65e..b9cd345 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp +++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -24,8 +24,7 @@ void CFWL_PushButtonTP::DrawBackground(const CFWL_ThemeBackground& pParams) { switch (pParams.m_iPart) { case CFWL_Part::Border: { - DrawBorder(pParams.m_pGraphics.Get(), pParams.m_PartRect, - pParams.m_matrix); + DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix); break; } case CFWL_Part::Background: { @@ -52,7 +51,7 @@ CFGAS_GEPath fillPath; fillPath.AddSubpath(strokePath); - CFGAS_GEGraphics* pGraphics = pParams.m_pGraphics.Get(); + CFGAS_GEGraphics* pGraphics = pParams.GetGraphics(); pGraphics->SaveGraphState(); CFX_RectF rtInner(rect);
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index 164d37d..f526922 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -20,7 +20,7 @@ CFWL_ScrollBarTP::~CFWL_ScrollBarTP() = default; void CFWL_ScrollBarTP::DrawBackground(const CFWL_ThemeBackground& pParams) { - CFWL_Widget* pWidget = pParams.m_pWidget; + CFWL_Widget* pWidget = pParams.GetWidget(); FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; if (pParams.m_dwStates & CFWL_PartState_Hovered) eState = FWLTHEME_STATE_Hover; @@ -29,7 +29,7 @@ else if (pParams.m_dwStates & CFWL_PartState_Disabled) eState = FWLTHEME_STATE_Disable; - CFGAS_GEGraphics* pGraphics = pParams.m_pGraphics.Get(); + CFGAS_GEGraphics* pGraphics = pParams.GetGraphics(); bool bVert = !!pWidget->GetStylesEx(); switch (pParams.m_iPart) { case CFWL_Part::ForeArrow: {
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index 7e763d1..e87fc3f 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -35,7 +35,7 @@ if (iLen <= 0) return; - CFGAS_GEGraphics* pGraphics = pParams.m_pGraphics; + CFGAS_GEGraphics* pGraphics = pParams.GetGraphics(); m_pTextOut->SetStyles(pParams.m_dwTTOStyles); m_pTextOut->SetAlignment(pParams.m_iTTOAlign);
diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp index ea73992..daaef0d 100644 --- a/xfa/fxfa/cxfa_fwltheme.cpp +++ b/xfa/fxfa/cxfa_fwltheme.cpp
@@ -84,15 +84,15 @@ } void CXFA_FWLTheme::DrawBackground(const CFWL_ThemeBackground& pParams) { - GetTheme(pParams.m_pWidget)->DrawBackground(pParams); + GetTheme(pParams.GetWidget())->DrawBackground(pParams); } 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 = GetOutmostFFWidget(pParams.m_pWidget); + if (pParams.GetWidget()->GetClassID() == FWL_Type::MonthCalendar) { + CXFA_FFWidget* pWidget = GetOutmostFFWidget(pParams.GetWidget()); if (!pWidget) return; @@ -110,7 +110,7 @@ if (pParams.m_iPart == CFWL_Part::Caption) m_pTextOut->SetTextColor(ArgbEncode(0xff, 0, 153, 255)); - CFGAS_GEGraphics* pGraphics = pParams.m_pGraphics; + CFGAS_GEGraphics* pGraphics = pParams.GetGraphics(); CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); CFX_Matrix mtPart = pParams.m_matrix; const CFX_Matrix* pMatrix = pGraphics->GetMatrix(); @@ -122,12 +122,12 @@ pParams.m_PartRect); return; } - CXFA_FFWidget* pWidget = GetOutmostFFWidget(pParams.m_pWidget); + CXFA_FFWidget* pWidget = GetOutmostFFWidget(pParams.GetWidget()); if (!pWidget) return; CXFA_Node* pNode = pWidget->GetNode(); - CFGAS_GEGraphics* pGraphics = pParams.m_pGraphics; + CFGAS_GEGraphics* pGraphics = pParams.GetGraphics(); CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); m_pTextOut->SetStyles(pParams.m_dwTTOStyles); m_pTextOut->SetAlignment(pParams.m_iTTOAlign); @@ -145,7 +145,7 @@ } CFX_RectF CXFA_FWLTheme::GetUIMargin(const CFWL_ThemePart& pThemePart) const { - CXFA_FFWidget* pWidget = GetOutmostFFWidget(pThemePart.m_pWidget); + CXFA_FFWidget* pWidget = GetOutmostFFWidget(pThemePart.GetWidget()); if (!pWidget) return CFX_RectF(); @@ -179,20 +179,20 @@ } float CXFA_FWLTheme::GetFontSize(const CFWL_ThemePart& pThemePart) const { - if (CXFA_FFWidget* pWidget = GetOutmostFFWidget(pThemePart.m_pWidget)) + if (CXFA_FFWidget* pWidget = GetOutmostFFWidget(pThemePart.GetWidget())) return pWidget->GetNode()->GetFontSize(); return FWLTHEME_CAPACITY_FontSize; } RetainPtr<CFGAS_GEFont> CXFA_FWLTheme::GetFont( const CFWL_ThemePart& pThemePart) const { - if (CXFA_FFWidget* pWidget = GetOutmostFFWidget(pThemePart.m_pWidget)) + if (CXFA_FFWidget* pWidget = GetOutmostFFWidget(pThemePart.GetWidget())) return pWidget->GetNode()->GetFGASFont(pWidget->GetDoc()); - return GetTheme(pThemePart.m_pWidget)->GetFont(); + return GetTheme(pThemePart.GetWidget())->GetFont(); } float CXFA_FWLTheme::GetLineHeight(const CFWL_ThemePart& pThemePart) const { - if (CXFA_FFWidget* pWidget = GetOutmostFFWidget(pThemePart.m_pWidget)) + if (CXFA_FFWidget* pWidget = GetOutmostFFWidget(pThemePart.GetWidget())) return pWidget->GetNode()->GetLineHeight(); return kLineHeight; } @@ -203,7 +203,7 @@ FX_COLORREF CXFA_FWLTheme::GetTextColor( const CFWL_ThemePart& pThemePart) const { - if (CXFA_FFWidget* pWidget = GetOutmostFFWidget(pThemePart.m_pWidget)) + if (CXFA_FFWidget* pWidget = GetOutmostFFWidget(pThemePart.GetWidget())) return pWidget->GetNode()->GetTextColor(); return FWLTHEME_CAPACITY_TextColor; } @@ -211,7 +211,7 @@ CFX_SizeF CXFA_FWLTheme::GetSpaceAboveBelow( const CFWL_ThemePart& pThemePart) const { CFX_SizeF sizeAboveBelow; - if (CXFA_FFWidget* pWidget = GetOutmostFFWidget(pThemePart.m_pWidget)) { + if (CXFA_FFWidget* pWidget = GetOutmostFFWidget(pThemePart.GetWidget())) { CXFA_Para* para = pWidget->GetNode()->GetParaIfExists(); if (para) { sizeAboveBelow.width = para->GetSpaceAbove(); @@ -226,11 +226,11 @@ if (!m_pTextOut) return; - CXFA_FFWidget* pWidget = GetOutmostFFWidget(pParams.m_pWidget); + CXFA_FFWidget* pWidget = GetOutmostFFWidget(pParams.GetWidget()); if (!pWidget) return; - if (pParams.m_pWidget->GetClassID() == FWL_Type::MonthCalendar) { + if (pParams.GetWidget()->GetClassID() == FWL_Type::MonthCalendar) { m_pTextOut->SetFont(m_pCalendarFont); m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);