Pass rectancles by const-ref in xfa/fwl/theme They too, are always present and not modified by methods. Change-Id: I0aa2d5b34a3656a1445aaf43f17a6a321eda1368 Reviewed-on: https://pdfium-review.googlesource.com/c/48493 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fwl/theme/cfwl_barcodetp.cpp b/xfa/fwl/theme/cfwl_barcodetp.cpp index 31548fb..222d008 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_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, + FillBackground(pParams.m_pGraphics.Get(), pParams.m_rtPart, pParams.m_matrix); break; default:
diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp index a322e7e..f6c84ba 100644 --- a/xfa/fwl/theme/cfwl_carettp.cpp +++ b/xfa/fwl/theme/cfwl_carettp.cpp
@@ -22,7 +22,7 @@ return; DrawCaretBK(pParams.m_pGraphics.Get(), pParams.m_dwStates, - &pParams.m_rtPart, pParams.m_matrix); + pParams.m_rtPart, pParams.m_matrix); break; } default: @@ -32,10 +32,9 @@ void CFWL_CaretTP::DrawCaretBK(CXFA_Graphics* pGraphics, uint32_t dwStates, - const CFX_RectF* pRect, + const CFX_RectF& rect, const CFX_Matrix& matrix) { CXFA_GEPath path; - CFX_RectF rect = *pRect; path.AddRectangle(rect.left, rect.top, rect.width, rect.height); pGraphics->SetFillColor(CXFA_GEColor(ArgbEncode(255, 0, 0, 0))); pGraphics->FillPath(&path, FXFILL_WINDING, &matrix);
diff --git a/xfa/fwl/theme/cfwl_carettp.h b/xfa/fwl/theme/cfwl_carettp.h index 864496c..a0f9dc5 100644 --- a/xfa/fwl/theme/cfwl_carettp.h +++ b/xfa/fwl/theme/cfwl_carettp.h
@@ -20,7 +20,7 @@ private: void DrawCaretBK(CXFA_Graphics* pGraphics, uint32_t dwStates, - const CFX_RectF* pRect, + const CFX_RectF& rect, const CFX_Matrix& matrix); };
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index ae69e7c..8d71d6b 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -59,14 +59,14 @@ } void CFWL_CheckBoxTP::DrawSignCheck(CXFA_Graphics* pGraphics, - const CFX_RectF* pRtSign, + const CFX_RectF& rtSign, FX_ARGB argbFill, const CFX_Matrix& matrix) { if (!m_pCheckPath) - InitCheckPath(pRtSign->width); + InitCheckPath(rtSign.width); CFX_Matrix mt; - mt.Translate(pRtSign->left, pRtSign->top); + mt.Translate(rtSign.left, rtSign.top); mt.Concat(matrix); pGraphics->SaveGraphState(); pGraphics->SetFillColor(CXFA_GEColor(argbFill)); @@ -75,11 +75,11 @@ } void CFWL_CheckBoxTP::DrawSignCircle(CXFA_Graphics* pGraphics, - const CFX_RectF* pRtSign, + const CFX_RectF& rtSign, FX_ARGB argbFill, const CFX_Matrix& matrix) { CXFA_GEPath path; - path.AddEllipse(*pRtSign); + path.AddEllipse(rtSign); pGraphics->SaveGraphState(); pGraphics->SetFillColor(CXFA_GEColor(argbFill)); pGraphics->FillPath(&path, FXFILL_WINDING, &matrix); @@ -87,15 +87,15 @@ } void CFWL_CheckBoxTP::DrawSignCross(CXFA_Graphics* pGraphics, - const CFX_RectF* pRtSign, + const CFX_RectF& rtSign, FX_ARGB argbFill, const CFX_Matrix& matrix) { CXFA_GEPath path; - float fRight = pRtSign->right(); - float fBottom = pRtSign->bottom(); - path.AddLine(pRtSign->TopLeft(), CFX_PointF(fRight, fBottom)); - path.AddLine(CFX_PointF(pRtSign->left, fBottom), - CFX_PointF(fRight, pRtSign->top)); + float fRight = rtSign.right(); + float fBottom = rtSign.bottom(); + path.AddLine(rtSign.TopLeft(), CFX_PointF(fRight, fBottom)); + path.AddLine(CFX_PointF(rtSign.left, fBottom), + CFX_PointF(fRight, rtSign.top)); pGraphics->SaveGraphState(); pGraphics->SetStrokeColor(CXFA_GEColor(argbFill)); @@ -105,18 +105,18 @@ } void CFWL_CheckBoxTP::DrawSignDiamond(CXFA_Graphics* pGraphics, - const CFX_RectF* pRtSign, + const CFX_RectF& rtSign, FX_ARGB argbFill, const CFX_Matrix& matrix) { CXFA_GEPath path; - float fWidth = pRtSign->width; - float fHeight = pRtSign->height; - float fBottom = pRtSign->bottom(); - path.MoveTo(CFX_PointF(pRtSign->left + fWidth / 2, pRtSign->top)); - path.LineTo(CFX_PointF(pRtSign->left, pRtSign->top + fHeight / 2)); - path.LineTo(CFX_PointF(pRtSign->left + fWidth / 2, fBottom)); - path.LineTo(CFX_PointF(pRtSign->right(), pRtSign->top + fHeight / 2)); - path.LineTo(CFX_PointF(pRtSign->left + fWidth / 2, pRtSign->top)); + float fWidth = rtSign.width; + float fHeight = rtSign.height; + float fBottom = rtSign.bottom(); + path.MoveTo(CFX_PointF(rtSign.left + fWidth / 2, rtSign.top)); + path.LineTo(CFX_PointF(rtSign.left, rtSign.top + fHeight / 2)); + path.LineTo(CFX_PointF(rtSign.left + fWidth / 2, fBottom)); + path.LineTo(CFX_PointF(rtSign.right(), rtSign.top + fHeight / 2)); + path.LineTo(CFX_PointF(rtSign.left + fWidth / 2, rtSign.top)); pGraphics->SaveGraphState(); pGraphics->SetFillColor(CXFA_GEColor(argbFill)); @@ -125,12 +125,11 @@ } void CFWL_CheckBoxTP::DrawSignSquare(CXFA_Graphics* pGraphics, - const CFX_RectF* pRtSign, + const CFX_RectF& rtSign, FX_ARGB argbFill, const CFX_Matrix& matrix) { CXFA_GEPath path; - path.AddRectangle(pRtSign->left, pRtSign->top, pRtSign->width, - pRtSign->height); + path.AddRectangle(rtSign.left, rtSign.top, rtSign.width, rtSign.height); pGraphics->SaveGraphState(); pGraphics->SetFillColor(CXFA_GEColor(argbFill)); pGraphics->FillPath(&path, FXFILL_WINDING, &matrix); @@ -138,15 +137,15 @@ } void CFWL_CheckBoxTP::DrawSignStar(CXFA_Graphics* pGraphics, - const CFX_RectF* pRtSign, + const CFX_RectF& rtSign, FX_ARGB argbFill, const CFX_Matrix& matrix) { CXFA_GEPath path; - float fBottom = pRtSign->bottom(); + float fBottom = rtSign.bottom(); float fRadius = - (pRtSign->top - fBottom) / (1 + static_cast<float>(cos(FX_PI / 5.0f))); - CFX_PointF ptCenter((pRtSign->left + pRtSign->right()) / 2.0f, - (pRtSign->top + fBottom) / 2.0f); + (rtSign.top - fBottom) / (1 + static_cast<float>(cos(FX_PI / 5.0f))); + CFX_PointF ptCenter((rtSign.left + rtSign.right()) / 2.0f, + (rtSign.top + fBottom) / 2.0f); CFX_PointF points[5]; float fAngel = FX_PI / 10.0f; @@ -287,22 +286,22 @@ rtSign.Deflate(rtSign.width / 4, rtSign.height / 4); switch (dwStyle & FWL_STYLEEXT_CKB_SignShapeMask) { case FWL_STYLEEXT_CKB_SignShapeCheck: - DrawSignCheck(pGraphics, &rtSign, dwColor, matrix); + DrawSignCheck(pGraphics, rtSign, dwColor, matrix); break; case FWL_STYLEEXT_CKB_SignShapeCircle: - DrawSignCircle(pGraphics, &rtSign, dwColor, matrix); + DrawSignCircle(pGraphics, rtSign, dwColor, matrix); break; case FWL_STYLEEXT_CKB_SignShapeCross: - DrawSignCross(pGraphics, &rtSign, dwColor, matrix); + DrawSignCross(pGraphics, rtSign, dwColor, matrix); break; case FWL_STYLEEXT_CKB_SignShapeDiamond: - DrawSignDiamond(pGraphics, &rtSign, dwColor, matrix); + DrawSignDiamond(pGraphics, rtSign, dwColor, matrix); break; case FWL_STYLEEXT_CKB_SignShapeSquare: - DrawSignSquare(pGraphics, &rtSign, dwColor, matrix); + DrawSignSquare(pGraphics, rtSign, dwColor, matrix); break; case FWL_STYLEEXT_CKB_SignShapeStar: - DrawSignStar(pGraphics, &rtSign, dwColor, matrix); + DrawSignStar(pGraphics, rtSign, dwColor, matrix); break; default: break;
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h index 51c7106..e576be3 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.h +++ b/xfa/fwl/theme/cfwl_checkboxtp.h
@@ -43,27 +43,27 @@ int32_t iState, const CFX_Matrix& matrix); void DrawSignCheck(CXFA_Graphics* pGraphics, - const CFX_RectF* pRtSign, + const CFX_RectF& rtSign, FX_ARGB argbFill, const CFX_Matrix& matrix); void DrawSignCircle(CXFA_Graphics* pGraphics, - const CFX_RectF* pRtSign, + const CFX_RectF& rtSign, FX_ARGB argbFill, const CFX_Matrix& matrix); void DrawSignCross(CXFA_Graphics* pGraphics, - const CFX_RectF* pRtSign, + const CFX_RectF& rtSign, FX_ARGB argbFill, const CFX_Matrix& matrix); void DrawSignDiamond(CXFA_Graphics* pGraphics, - const CFX_RectF* pRtSign, + const CFX_RectF& rtSign, FX_ARGB argbFill, const CFX_Matrix& matrix); void DrawSignSquare(CXFA_Graphics* pGraphics, - const CFX_RectF* pRtSign, + const CFX_RectF& rtSign, FX_ARGB argbFill, const CFX_Matrix& matrix); void DrawSignStar(CXFA_Graphics* pGraphics, - const CFX_RectF* pRtSign, + const CFX_RectF& rtSign, FX_ARGB argbFill, const CFX_Matrix& matrix);
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp index 9705219..ff179b8 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_rtPart, - pParams.m_matrix); + DrawBorder(pParams.m_pGraphics.Get(), pParams.m_rtPart, pParams.m_matrix); break; } case CFWL_Part::Background: { @@ -92,6 +91,6 @@ default: break; } - DrawArrowBtn(pParams.m_pGraphics.Get(), &pParams.m_rtPart, + DrawArrowBtn(pParams.m_pGraphics.Get(), pParams.m_rtPart, FWLTHEME_DIRECTION_Down, eState, pParams.m_matrix); }
diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.cpp b/xfa/fwl/theme/cfwl_datetimepickertp.cpp index 7693c6c..a185952 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_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); @@ -54,6 +53,6 @@ default: break; } - DrawArrowBtn(pParams.m_pGraphics.Get(), &pParams.m_rtPart, + DrawArrowBtn(pParams.m_pGraphics.Get(), pParams.m_rtPart, FWLTHEME_DIRECTION_Down, eState, matrix); }
diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp index d1e6c22..2832fc0 100644 --- a/xfa/fwl/theme/cfwl_edittp.cpp +++ b/xfa/fwl/theme/cfwl_edittp.cpp
@@ -43,8 +43,7 @@ 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: {
diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp index c3eb313..73c4839 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.cpp +++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -19,22 +19,21 @@ 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); + pParams.m_rtPart, pParams.m_matrix); if (pParams.m_pRtData) { FillSolidRect(pParams.m_pGraphics.Get(), FWLTHEME_COLOR_Background, - pParams.m_pRtData, pParams.m_matrix); + *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); + pParams.m_rtPart, pParams.m_pRtData, pParams.m_matrix); break; } case CFWL_Part::Check: { @@ -44,7 +43,7 @@ } else if (pParams.m_dwStates == CFWL_PartState_Normal) { color = 0xFF0000FF; } - FillSolidRect(pParams.m_pGraphics.Get(), color, &pParams.m_rtPart, + FillSolidRect(pParams.m_pGraphics.Get(), color, pParams.m_rtPart, pParams.m_matrix); break; } @@ -55,22 +54,22 @@ void CFWL_ListBoxTP::DrawListBoxItem(CXFA_Graphics* pGraphics, uint32_t dwStates, - const CFX_RectF* prtItem, + const CFX_RectF& rtItem, const CFX_RectF* pData, const CFX_Matrix& matrix) { if (dwStates & CFWL_PartState_Selected) { pGraphics->SaveGraphState(); pGraphics->SetFillColor(CXFA_GEColor(FWLTHEME_COLOR_BKSelected)); - CFX_RectF rt(*prtItem); CXFA_GEPath path; #if (_FX_OS_ == _FX_OS_MACOSX_) - path.AddRectangle(rt.left, rt.top, rt.width - 1, rt.height - 1); + path.AddRectangle(rtItem.left, rtItem.top, rtItem.width - 1, + rtItem.height - 1); #else - path.AddRectangle(rt.left, rt.top, rt.width, rt.height); + path.AddRectangle(rtItem.left, rtItem.top, rtItem.width, rtItem.height); #endif pGraphics->FillPath(&path, FXFILL_WINDING, &matrix); pGraphics->RestoreGraphState(); } if ((dwStates & CFWL_PartState_Focused) && pData) - DrawFocus(pGraphics, pData, matrix); + DrawFocus(pGraphics, *pData, matrix); }
diff --git a/xfa/fwl/theme/cfwl_listboxtp.h b/xfa/fwl/theme/cfwl_listboxtp.h index e67d29c..ee954b8 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.h +++ b/xfa/fwl/theme/cfwl_listboxtp.h
@@ -20,7 +20,7 @@ private: void DrawListBoxItem(CXFA_Graphics* pGraphics, uint32_t dwStates, - const CFX_RectF* prtItem, + const CFX_RectF& rtItem, const CFX_RectF* pData, const CFX_Matrix& matrix); };
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp index 909344f..8975fef 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_rtPart, - pParams.m_matrix); + DrawBorder(pParams.m_pGraphics.Get(), pParams.m_rtPart, 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_rtPart, + 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, + DrawArrowBtn(pParams.m_pGraphics.Get(), pParams.m_rtPart, FWLTHEME_DIRECTION_Right, eState, pParams.m_matrix); break; }
diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.cpp b/xfa/fwl/theme/cfwl_pictureboxtp.cpp index 251356f..39611bd 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_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_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp index 210aa3e..4191bd2 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_rtPart, - pParams.m_matrix); + DrawBorder(pParams.m_pGraphics.Get(), pParams.m_rtPart, pParams.m_matrix); break; } case CFWL_Part::Background: { @@ -62,7 +61,7 @@ rtInner.height); int32_t iColor = GetColorID(pParams.m_dwStates); - FillSolidRect(pGraphics, m_pThemeData->clrEnd[iColor], &rect, + FillSolidRect(pGraphics, m_pThemeData->clrEnd[iColor], rect, pParams.m_matrix); pGraphics->SetStrokeColor(CXFA_GEColor(m_pThemeData->clrBorder[iColor])); @@ -76,7 +75,7 @@ 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_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index c557c69..65eb989 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -36,31 +36,33 @@ eState = FWLTHEME_STATE_Disable; CXFA_Graphics* pGraphics = pParams.m_pGraphics.Get(); - const CFX_RectF* pRect = &pParams.m_rtPart; bool bVert = !!pWidget->GetStylesEx(); switch (pParams.m_iPart) { case CFWL_Part::ForeArrow: { - DrawMaxMinBtn(pGraphics, pRect, + DrawMaxMinBtn(pGraphics, pParams.m_rtPart, bVert ? FWLTHEME_DIRECTION_Up : FWLTHEME_DIRECTION_Left, eState, pParams.m_matrix); break; } case CFWL_Part::BackArrow: { - DrawMaxMinBtn(pGraphics, pRect, + DrawMaxMinBtn(pGraphics, pParams.m_rtPart, bVert ? FWLTHEME_DIRECTION_Down : FWLTHEME_DIRECTION_Right, eState, pParams.m_matrix); break; } case CFWL_Part::Thumb: { - DrawThumbBtn(pGraphics, pRect, bVert, eState, true, pParams.m_matrix); + DrawThumbBtn(pGraphics, pParams.m_rtPart, bVert, eState, true, + pParams.m_matrix); break; } case CFWL_Part::LowerTrack: { - DrawTrack(pGraphics, pRect, bVert, eState, true, pParams.m_matrix); + DrawTrack(pGraphics, pParams.m_rtPart, bVert, eState, true, + pParams.m_matrix); break; } case CFWL_Part::UpperTrack: { - DrawTrack(pGraphics, pRect, bVert, eState, false, pParams.m_matrix); + DrawTrack(pGraphics, pParams.m_rtPart, bVert, eState, false, + pParams.m_matrix); break; } default: @@ -69,7 +71,7 @@ } void CFWL_ScrollBarTP::DrawThumbBtn(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& input_rect, bool bVert, FWLTHEME_STATE eState, bool bPawButton, @@ -77,7 +79,7 @@ if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disable) return; - CFX_RectF rect(*pRect); + CFX_RectF rect = input_rect; if (bVert) rect.Deflate(1, 0); else @@ -86,8 +88,7 @@ if (rect.IsEmpty(0.1f)) return; - FillSolidRect(pGraphics, m_pThemeData->clrBtnBK[eState - 1][1], &rect, - matrix); + FillSolidRect(pGraphics, m_pThemeData->clrBtnBK[eState - 1][1], rect, matrix); pGraphics->SaveGraphState(); @@ -100,19 +101,19 @@ } void CFWL_ScrollBarTP::DrawPaw(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, bool bVert, FWLTHEME_STATE eState, const CFX_Matrix& matrix) { CXFA_GEPath path; if (bVert) { float fPawLen = kPawLength; - if (pRect->width / 2 <= fPawLen) { - fPawLen = (pRect->width - 6) / 2; + if (rect.width / 2 <= fPawLen) { + fPawLen = (rect.width - 6) / 2; } - float fX = pRect->left + pRect->width / 4; - float fY = pRect->top + pRect->height / 2; + float fX = rect.left + rect.width / 4; + float fY = rect.top + rect.height / 2; path.MoveTo(CFX_PointF(fX, fY - 4)); path.LineTo(CFX_PointF(fX + fPawLen, fY - 4)); path.MoveTo(CFX_PointF(fX, fY - 2)); @@ -144,12 +145,12 @@ pGraphics->StrokePath(&path, &matrix); } else { float fPawLen = kPawLength; - if (pRect->height / 2 <= fPawLen) { - fPawLen = (pRect->height - 6) / 2; + if (rect.height / 2 <= fPawLen) { + fPawLen = (rect.height - 6) / 2; } - float fX = pRect->left + pRect->width / 2; - float fY = pRect->top + pRect->height / 4; + float fX = rect.left + rect.width / 2; + float fY = rect.top + rect.height / 4; path.MoveTo(CFX_PointF(fX - 4, fY)); path.LineTo(CFX_PointF(fX - 4, fY + fPawLen)); path.MoveTo(CFX_PointF(fX - 2, fY)); @@ -183,7 +184,7 @@ } void CFWL_ScrollBarTP::DrawTrack(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, bool bVert, FWLTHEME_STATE eState, bool bLowerTrack, @@ -193,35 +194,34 @@ pGraphics->SaveGraphState(); CXFA_GEPath path; - float fRight = pRect->right(); - float fBottom = pRect->bottom(); + float fRight = rect.right(); + float fBottom = rect.bottom(); if (bVert) { - path.AddRectangle(pRect->left, pRect->top, 1, pRect->height); - path.AddRectangle(fRight - 1, pRect->top, 1, pRect->height); + path.AddRectangle(rect.left, rect.top, 1, rect.height); + path.AddRectangle(fRight - 1, rect.top, 1, rect.height); } else { - path.AddRectangle(pRect->left, pRect->top, pRect->width, 1); - path.AddRectangle(pRect->left, fBottom - 1, pRect->width, 1); + path.AddRectangle(rect.left, rect.top, rect.width, 1); + path.AddRectangle(rect.left, fBottom - 1, rect.width, 1); } pGraphics->SetFillColor(CXFA_GEColor(ArgbEncode(255, 238, 237, 229))); pGraphics->FillPath(&path, FXFILL_WINDING, &matrix); path.Clear(); - path.AddRectangle(pRect->left + 1, pRect->top, pRect->width - 2, - pRect->height); + path.AddRectangle(rect.left + 1, rect.top, rect.width - 2, rect.height); pGraphics->RestoreGraphState(); - FillSolidRect(pGraphics, m_pThemeData->clrTrackBKEnd, pRect, matrix); + FillSolidRect(pGraphics, m_pThemeData->clrTrackBKEnd, rect, matrix); } void CFWL_ScrollBarTP::DrawMaxMinBtn(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, FWLTHEME_DIRECTION eDict, FWLTHEME_STATE eState, const CFX_Matrix& matrix) { - DrawTrack(pGraphics, pRect, + DrawTrack(pGraphics, rect, eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down, eState, true, matrix); - CFX_RectF rtArrowBtn(*pRect); + CFX_RectF rtArrowBtn = rect; rtArrowBtn.Deflate(1, 1, 1, 1); - DrawArrowBtn(pGraphics, &rtArrowBtn, eDict, eState, matrix); + DrawArrowBtn(pGraphics, rtArrowBtn, eDict, eState, matrix); } void CFWL_ScrollBarTP::SetThemeData() {
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.h b/xfa/fwl/theme/cfwl_scrollbartp.h index 8f26b83..f07d102 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.h +++ b/xfa/fwl/theme/cfwl_scrollbartp.h
@@ -30,24 +30,24 @@ }; void DrawThumbBtn(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, bool bVert, FWLTHEME_STATE eState, bool bPawButton, const CFX_Matrix& matrix); void DrawTrack(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, bool bVert, FWLTHEME_STATE eState, bool bLowerTrack, const CFX_Matrix& matrix); void DrawMaxMinBtn(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, FWLTHEME_DIRECTION eDict, FWLTHEME_STATE eState, const CFX_Matrix& matrix); void DrawPaw(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, bool bVert, FWLTHEME_STATE eState, const CFX_Matrix& matrix);
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index d756a9a..06250ba 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -101,15 +101,15 @@ } void CFWL_WidgetTP::DrawBorder(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, const CFX_Matrix& matrix) { - if (!pGraphics || !pRect) + if (!pGraphics) return; CXFA_GEPath path; - path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); - path.AddRectangle(pRect->left + 1, pRect->top + 1, pRect->width - 2, - pRect->height - 2); + path.AddRectangle(rect.left, rect.top, rect.width, rect.height); + path.AddRectangle(rect.left + 1, rect.top + 1, rect.width - 2, + rect.height - 2); pGraphics->SaveGraphState(); pGraphics->SetFillColor(CXFA_GEColor(ArgbEncode(255, 0, 0, 0))); pGraphics->FillPath(&path, FXFILL_ALTERNATE, &matrix); @@ -117,20 +117,20 @@ } void CFWL_WidgetTP::FillBackground(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, const CFX_Matrix& matrix) { - FillSolidRect(pGraphics, FWLTHEME_COLOR_Background, pRect, matrix); + FillSolidRect(pGraphics, FWLTHEME_COLOR_Background, rect, matrix); } void CFWL_WidgetTP::FillSolidRect(CXFA_Graphics* pGraphics, FX_ARGB fillColor, - const CFX_RectF* pRect, + const CFX_RectF& rect, const CFX_Matrix& matrix) { - if (!pGraphics || !pRect) + if (!pGraphics) return; CXFA_GEPath path; - path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); + path.AddRectangle(rect.left, rect.top, rect.width, rect.height); pGraphics->SaveGraphState(); pGraphics->SetFillColor(CXFA_GEColor(fillColor)); pGraphics->FillPath(&path, FXFILL_WINDING, &matrix); @@ -138,13 +138,13 @@ } void CFWL_WidgetTP::DrawFocus(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, const CFX_Matrix& matrix) { - if (!pGraphics || !pRect) + if (!pGraphics) return; CXFA_GEPath path; - path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); + path.AddRectangle(rect.left, rect.top, rect.width, rect.height); pGraphics->SaveGraphState(); pGraphics->SetStrokeColor(CXFA_GEColor(0xFF000000)); static constexpr float kDashPattern[2] = {1, 1}; @@ -154,16 +154,14 @@ } void CFWL_WidgetTP::DrawArrow(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, FWLTHEME_DIRECTION eDict, FX_ARGB argSign, const CFX_Matrix& matrix) { bool bVert = (eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down); - float fLeft = - (float)(((pRect->width - (bVert ? 9 : 6)) / 2 + pRect->left) + 0.5); - float fTop = - (float)(((pRect->height - (bVert ? 6 : 9)) / 2 + pRect->top) + 0.5); + float fLeft = (float)(((rect.width - (bVert ? 9 : 6)) / 2 + rect.left) + 0.5); + float fTop = (float)(((rect.height - (bVert ? 6 : 9)) / 2 + rect.top) + 0.5); CXFA_GEPath path; switch (eDict) { case FWLTHEME_DIRECTION_Down: { @@ -208,26 +206,26 @@ } void CFWL_WidgetTP::DrawBtn(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, FWLTHEME_STATE eState, const CFX_Matrix& matrix) { InitializeArrowColorData(); - FillSolidRect(pGraphics, m_pColorData->clrEnd[eState - 1], pRect, matrix); + FillSolidRect(pGraphics, m_pColorData->clrEnd[eState - 1], rect, matrix); CXFA_GEPath path; - path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); + path.AddRectangle(rect.left, rect.top, rect.width, rect.height); pGraphics->SetStrokeColor(CXFA_GEColor(m_pColorData->clrBorder[eState - 1])); pGraphics->StrokePath(&path, &matrix); } void CFWL_WidgetTP::DrawArrowBtn(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, FWLTHEME_DIRECTION eDict, FWLTHEME_STATE eState, const CFX_Matrix& matrix) { - DrawBtn(pGraphics, pRect, eState, matrix); + DrawBtn(pGraphics, rect, eState, matrix); InitializeArrowColorData(); - DrawArrow(pGraphics, pRect, eDict, m_pColorData->clrSign[eState - 1], matrix); + DrawArrow(pGraphics, rect, eDict, m_pColorData->clrSign[eState - 1], matrix); } CFWL_FontData::CFWL_FontData() : m_dwStyles(0), m_dwCodePage(0) {}
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index caf65f5..63648ff 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -49,29 +49,29 @@ void FinalizeTTO(); void DrawBorder(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, const CFX_Matrix& matrix); void FillBackground(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, const CFX_Matrix& matrix); void FillSolidRect(CXFA_Graphics* pGraphics, FX_ARGB fillColor, - const CFX_RectF* pRect, + const CFX_RectF& rect, const CFX_Matrix& matrix); void DrawFocus(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, const CFX_Matrix& matrix); void DrawArrow(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, FWLTHEME_DIRECTION eDict, FX_ARGB argSign, const CFX_Matrix& matrix); void DrawBtn(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, FWLTHEME_STATE eState, const CFX_Matrix& matrix); void DrawArrowBtn(CXFA_Graphics* pGraphics, - const CFX_RectF* pRect, + const CFX_RectF& rect, FWLTHEME_DIRECTION eDict, FWLTHEME_STATE eState, const CFX_Matrix& matrix);