diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-08-16 15:09:00 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-16 22:54:39 +0000 |
commit | 574015e0ad53c592fe8a923390b31edeb30c41fe (patch) | |
tree | a3774207ebb4c1fc5b5abfb90a32adf974f76a10 /xfa/fwl/theme | |
parent | a364729be3725adbc9689c1c8c23902df102243b (diff) | |
download | pdfium-574015e0ad53c592fe8a923390b31edeb30c41fe.tar.xz |
Tidy CXFA_Color class and argument passing.
Remove friendship.
De-virtualize.
Nest enum inside class.
Make copy-assignable and pass by const ref.
Make pack better on 64-bits.
Change-Id: I1ae3b6d03756fa5780e9023795db6648e8b8299a
Reviewed-on: https://pdfium-review.googlesource.com/11290
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fwl/theme')
-rw-r--r-- | xfa/fwl/theme/cfwl_carettp.cpp | 5 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_checkboxtp.cpp | 20 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_comboboxtp.cpp | 6 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_edittp.cpp | 21 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_listboxtp.cpp | 3 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_monthcalendartp.cpp | 66 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_pushbuttontp.cpp | 6 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_scrollbartp.cpp | 29 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_widgettp.cpp | 42 |
9 files changed, 78 insertions, 120 deletions
diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp index 64eef9ffc9..37dfad5146 100644 --- a/xfa/fwl/theme/cfwl_carettp.cpp +++ b/xfa/fwl/theme/cfwl_carettp.cpp @@ -43,10 +43,9 @@ void CFWL_CaretTP::DrawCaretBK(CXFA_Graphics* pGraphics, CFX_RectF rect = *pRect; path.AddRectangle(rect.left, rect.top, rect.width, rect.height); if (crFill) { - pGraphics->SetFillColor(crFill); + pGraphics->SetFillColor(*crFill); } else { - CXFA_Color crFilltemp(ArgbEncode(255, 0, 0, 0)); - pGraphics->SetFillColor(&crFilltemp); + pGraphics->SetFillColor(CXFA_Color(ArgbEncode(255, 0, 0, 0))); } pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); } diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index 334c1912a3..e783098347 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -64,12 +64,10 @@ void CFWL_CheckBoxTP::DrawSignCheck(CXFA_Graphics* pGraphics, InitCheckPath(pRtSign->width); CFX_Matrix mt; - mt.SetIdentity(); mt.Translate(pRtSign->left, pRtSign->top); mt.Concat(*pMatrix); - CXFA_Color crFill(argbFill); pGraphics->SaveGraphState(); - pGraphics->SetFillColor(&crFill); + pGraphics->SetFillColor(CXFA_Color(argbFill)); pGraphics->FillPath(m_pCheckPath.get(), FXFILL_WINDING, &mt); pGraphics->RestoreGraphState(); } @@ -80,9 +78,8 @@ void CFWL_CheckBoxTP::DrawSignCircle(CXFA_Graphics* pGraphics, CFX_Matrix* pMatrix) { CXFA_Path path; path.AddEllipse(*pRtSign); - CXFA_Color crFill(argbFill); pGraphics->SaveGraphState(); - pGraphics->SetFillColor(&crFill); + pGraphics->SetFillColor(CXFA_Color(argbFill)); pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pGraphics->RestoreGraphState(); } @@ -98,9 +95,8 @@ void CFWL_CheckBoxTP::DrawSignCross(CXFA_Graphics* pGraphics, path.AddLine(CFX_PointF(pRtSign->left, fBottom), CFX_PointF(fRight, pRtSign->top)); - CXFA_Color crFill(argbFill); pGraphics->SaveGraphState(); - pGraphics->SetStrokeColor(&crFill); + pGraphics->SetStrokeColor(CXFA_Color(argbFill)); pGraphics->SetLineWidth(1.0f); pGraphics->StrokePath(&path, pMatrix); pGraphics->RestoreGraphState(); @@ -120,9 +116,8 @@ void CFWL_CheckBoxTP::DrawSignDiamond(CXFA_Graphics* pGraphics, path.LineTo(CFX_PointF(pRtSign->right(), pRtSign->top + fHeight / 2)); path.LineTo(CFX_PointF(pRtSign->left + fWidth / 2, pRtSign->top)); - CXFA_Color crFill(argbFill); pGraphics->SaveGraphState(); - pGraphics->SetFillColor(&crFill); + pGraphics->SetFillColor(CXFA_Color(argbFill)); pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pGraphics->RestoreGraphState(); } @@ -134,9 +129,8 @@ void CFWL_CheckBoxTP::DrawSignSquare(CXFA_Graphics* pGraphics, CXFA_Path path; path.AddRectangle(pRtSign->left, pRtSign->top, pRtSign->width, pRtSign->height); - CXFA_Color crFill(argbFill); pGraphics->SaveGraphState(); - pGraphics->SetFillColor(&crFill); + pGraphics->SetFillColor(CXFA_Color(argbFill)); pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pGraphics->RestoreGraphState(); } @@ -170,10 +164,8 @@ void CFWL_CheckBoxTP::DrawSignStar(CXFA_Graphics* pGraphics, path.LineTo(points[nNext]); } - - CXFA_Color crFill(argbFill); pGraphics->SaveGraphState(); - pGraphics->SetFillColor(&crFill); + pGraphics->SetFillColor(CXFA_Color(argbFill)); pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pGraphics->RestoreGraphState(); } diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp index d8852ffe52..86888c0487 100644 --- a/xfa/fwl/theme/cfwl_comboboxtp.cpp +++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp @@ -42,8 +42,7 @@ void CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { argb_color = 0xFFFFFFFF; } pParams->m_pGraphics->SaveGraphState(); - CXFA_Color cr(argb_color); - pParams->m_pGraphics->SetFillColor(&cr); + pParams->m_pGraphics->SetFillColor(CXFA_Color(argb_color)); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); pParams->m_pGraphics->RestoreGraphState(); break; @@ -67,8 +66,7 @@ void CFWL_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams, CXFA_Path path; path.AddRectangle(pParams->m_rtPart.left, pParams->m_rtPart.top, pParams->m_rtPart.width - 1, pParams->m_rtPart.height); - CXFA_Color cr(ArgbEncode(0xff, 0xff, 0, 0)); - pParams->m_pGraphics->SetFillColor(&cr); + pParams->m_pGraphics->SetFillColor(CXFA_Color(ArgbEncode(0xff, 0xff, 0, 0))); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); } diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp index 19486fef16..0300deaba4 100644 --- a/xfa/fwl/theme/cfwl_edittp.cpp +++ b/xfa/fwl/theme/cfwl_edittp.cpp @@ -30,8 +30,7 @@ void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { fWidth = edge.GetThickness(); } } - CXFA_Color crLine(cr); - pParams->m_pGraphics->SetStrokeColor(&crLine); + pParams->m_pGraphics->SetStrokeColor(CXFA_Color(cr)); pParams->m_pGraphics->SetLineWidth(fWidth); pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); return; @@ -46,8 +45,7 @@ void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (pParams->m_pPath) { CXFA_Graphics* pGraphics = pParams->m_pGraphics; pGraphics->SaveGraphState(); - CXFA_Color crSelected(FWLTHEME_COLOR_BKSelected); - pGraphics->SetFillColor(&crSelected); + pGraphics->SetFillColor(CXFA_Color(FWLTHEME_COLOR_BKSelected)); pGraphics->FillPath(pParams->m_pPath, FXFILL_WINDING, &pParams->m_matrix); pGraphics->RestoreGraphState(); @@ -58,14 +56,14 @@ void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { CXFA_Color cr(FWLTHEME_COLOR_Background); if (!pParams->m_bStaticBackground) { if (pParams->m_dwStates & CFWL_PartState_Disabled) - cr.Set(FWLTHEME_COLOR_EDGERB1); + cr = CXFA_Color(FWLTHEME_COLOR_EDGERB1); else if (pParams->m_dwStates & CFWL_PartState_ReadOnly) - cr.Set(ArgbEncode(255, 236, 233, 216)); + cr = CXFA_Color(ArgbEncode(255, 236, 233, 216)); else - cr.Set(0xFFFFFFFF); + cr = CXFA_Color(0xFFFFFFFF); } pParams->m_pGraphics->SaveGraphState(); - pParams->m_pGraphics->SetFillColor(&cr); + pParams->m_pGraphics->SetFillColor(cr); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); pParams->m_pGraphics->RestoreGraphState(); @@ -73,11 +71,8 @@ void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { break; } case CFWL_Part::CombTextLine: { - FX_ARGB cr = 0xFF000000; - float fWidth = 1.0f; - CXFA_Color crLine(cr); - pParams->m_pGraphics->SetStrokeColor(&crLine); - pParams->m_pGraphics->SetLineWidth(fWidth); + pParams->m_pGraphics->SetStrokeColor(CXFA_Color(0xFF000000)); + pParams->m_pGraphics->SetLineWidth(1.0f); pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); break; } diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp index caa764f953..8ea90198a3 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.cpp +++ b/xfa/fwl/theme/cfwl_listboxtp.cpp @@ -66,8 +66,7 @@ void CFWL_ListBoxTP::DrawListBoxItem(CXFA_Graphics* pGraphics, CFX_Matrix* pMatrix) { if (dwStates & CFWL_PartState_Selected) { pGraphics->SaveGraphState(); - CXFA_Color crFill(FWLTHEME_COLOR_BKSelected); - pGraphics->SetFillColor(&crFill); + pGraphics->SetFillColor(CXFA_Color(FWLTHEME_COLOR_BKSelected)); CFX_RectF rt(*prtItem); CXFA_Path path; #if (_FX_OS_ == _FX_MACOSX_) diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp index 8b73bac668..975ca013f7 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp +++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp @@ -108,9 +108,7 @@ void CFWL_MonthCalendarTP::DrawTotalBK(CFWL_ThemeBackground* pParams, CFX_RectF rtTotal(pParams->m_rtPart); path.AddRectangle(rtTotal.left, rtTotal.top, rtTotal.width, rtTotal.height); pParams->m_pGraphics->SaveGraphState(); - - CXFA_Color clrBK(m_pThemeData->clrBK); - pParams->m_pGraphics->SetFillColor(&clrBK); + pParams->m_pGraphics->SetFillColor(CXFA_Color(m_pThemeData->clrBK)); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pParams->m_pGraphics->RestoreGraphState(); } @@ -121,9 +119,7 @@ void CFWL_MonthCalendarTP::DrawHeadBk(CFWL_ThemeBackground* pParams, CFX_RectF rtHead = pParams->m_rtPart; path.AddRectangle(rtHead.left, rtHead.top, rtHead.width, rtHead.height); pParams->m_pGraphics->SaveGraphState(); - - CXFA_Color clrHeadBK(m_pThemeData->clrBK); - pParams->m_pGraphics->SetFillColor(&clrHeadBK); + pParams->m_pGraphics->SetFillColor(CXFA_Color(m_pThemeData->clrBK)); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pParams->m_pGraphics->RestoreGraphState(); } @@ -134,17 +130,16 @@ void CFWL_MonthCalendarTP::DrawLButton(CFWL_ThemeBackground* pParams, CFX_RectF rtLBtn = pParams->m_rtPart; path.AddRectangle(rtLBtn.left, rtLBtn.top, rtLBtn.width, rtLBtn.height); pParams->m_pGraphics->SaveGraphState(); - - CXFA_Color clrLBtnEdge(ArgbEncode(0xff, 205, 219, 243)); - pParams->m_pGraphics->SetStrokeColor(&clrLBtnEdge); + pParams->m_pGraphics->SetStrokeColor( + CXFA_Color(ArgbEncode(0xff, 205, 219, 243))); pParams->m_pGraphics->StrokePath(&path, pMatrix); if (pParams->m_dwStates & CFWL_PartState_Pressed) { - CXFA_Color clrLBtnFill(ArgbEncode(0xff, 174, 198, 242)); - pParams->m_pGraphics->SetFillColor(&clrLBtnFill); + pParams->m_pGraphics->SetFillColor( + CXFA_Color(ArgbEncode(0xff, 174, 198, 242))); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); } else { - CXFA_Color clrLBtnFill(ArgbEncode(0xff, 227, 235, 249)); - pParams->m_pGraphics->SetFillColor(&clrLBtnFill); + pParams->m_pGraphics->SetFillColor( + CXFA_Color(ArgbEncode(0xff, 227, 235, 249))); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); } @@ -156,8 +151,8 @@ void CFWL_MonthCalendarTP::DrawLButton(CFWL_ThemeBackground* pParams, path.LineTo(CFX_PointF(rtLBtn.left + rtLBtn.Width() / 3 * 2, rtLBtn.bottom() - rtLBtn.height / 4)); - CXFA_Color clrFlag(ArgbEncode(0xff, 50, 104, 205)); - pParams->m_pGraphics->SetStrokeColor(&clrFlag); + pParams->m_pGraphics->SetStrokeColor( + CXFA_Color(ArgbEncode(0xff, 50, 104, 205))); pParams->m_pGraphics->StrokePath(&path, pMatrix); pParams->m_pGraphics->RestoreGraphState(); } @@ -168,17 +163,16 @@ void CFWL_MonthCalendarTP::DrawRButton(CFWL_ThemeBackground* pParams, CFX_RectF rtRBtn = pParams->m_rtPart; path.AddRectangle(rtRBtn.left, rtRBtn.top, rtRBtn.width, rtRBtn.height); pParams->m_pGraphics->SaveGraphState(); - - CXFA_Color clrRBtnEdge(ArgbEncode(0xff, 205, 219, 243)); - pParams->m_pGraphics->SetStrokeColor(&clrRBtnEdge); + pParams->m_pGraphics->SetStrokeColor( + CXFA_Color(ArgbEncode(0xff, 205, 219, 243))); pParams->m_pGraphics->StrokePath(&path, pMatrix); if (pParams->m_dwStates & CFWL_PartState_Pressed) { - CXFA_Color clrRBtnFill(ArgbEncode(0xff, 174, 198, 242)); - pParams->m_pGraphics->SetFillColor(&clrRBtnFill); + pParams->m_pGraphics->SetFillColor( + CXFA_Color(ArgbEncode(0xff, 174, 198, 242))); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); } else { - CXFA_Color clrRBtnFill(ArgbEncode(0xff, 227, 235, 249)); - pParams->m_pGraphics->SetFillColor(&clrRBtnFill); + pParams->m_pGraphics->SetFillColor( + CXFA_Color(ArgbEncode(0xff, 227, 235, 249))); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); } @@ -190,8 +184,8 @@ void CFWL_MonthCalendarTP::DrawRButton(CFWL_ThemeBackground* pParams, path.LineTo(CFX_PointF(rtRBtn.left + rtRBtn.Width() / 3, rtRBtn.bottom() - rtRBtn.height / 4)); - CXFA_Color clrFlag(ArgbEncode(0xff, 50, 104, 205)); - pParams->m_pGraphics->SetStrokeColor(&clrFlag); + pParams->m_pGraphics->SetStrokeColor( + CXFA_Color(ArgbEncode(0xff, 50, 104, 205))); pParams->m_pGraphics->StrokePath(&path, pMatrix); pParams->m_pGraphics->RestoreGraphState(); } @@ -203,9 +197,7 @@ void CFWL_MonthCalendarTP::DrawHSeperator(CFWL_ThemeBackground* pParams, 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(); - - CXFA_Color clrHSep(m_pThemeData->clrSeperator); - pParams->m_pGraphics->SetStrokeColor(&clrHSep); + pParams->m_pGraphics->SetStrokeColor(CXFA_Color(m_pThemeData->clrSeperator)); pParams->m_pGraphics->StrokePath(&path, pMatrix); pParams->m_pGraphics->RestoreGraphState(); } @@ -217,9 +209,7 @@ void CFWL_MonthCalendarTP::DrawWeekNumSep(CFWL_ThemeBackground* pParams, path.MoveTo(rtWeekSep.TopLeft()); path.LineTo(rtWeekSep.BottomLeft()); pParams->m_pGraphics->SaveGraphState(); - - CXFA_Color clrHSep(m_pThemeData->clrSeperator); - pParams->m_pGraphics->SetStrokeColor(&clrHSep); + pParams->m_pGraphics->SetStrokeColor(CXFA_Color(m_pThemeData->clrSeperator)); pParams->m_pGraphics->StrokePath(&path, pMatrix); pParams->m_pGraphics->RestoreGraphState(); } @@ -232,16 +222,16 @@ void CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams, CFX_RectF rtSelDay = pParams->m_rtPart; path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, rtSelDay.height); - CXFA_Color clrSelDayBK(m_pThemeData->clrDatesSelectedBK); - pParams->m_pGraphics->SetFillColor(&clrSelDayBK); + pParams->m_pGraphics->SetFillColor( + CXFA_Color(m_pThemeData->clrDatesSelectedBK)); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); } else if (pParams->m_dwStates & CFWL_PartState_Hovered) { CXFA_Path path; CFX_RectF rtSelDay = pParams->m_rtPart; path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, rtSelDay.height); - CXFA_Color clrSelDayBK(m_pThemeData->clrDatesHoverBK); - pParams->m_pGraphics->SetFillColor(&clrSelDayBK); + pParams->m_pGraphics->SetFillColor( + CXFA_Color(m_pThemeData->clrDatesHoverBK)); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); } pParams->m_pGraphics->RestoreGraphState(); @@ -254,8 +244,8 @@ void CFWL_MonthCalendarTP::DrawDatesInCircle(CFWL_ThemeBackground* pParams, path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, rtSelDay.height); pParams->m_pGraphics->SaveGraphState(); - CXFA_Color clrSelDayBK(m_pThemeData->clrDatesCircle); - pParams->m_pGraphics->SetStrokeColor(&clrSelDayBK); + pParams->m_pGraphics->SetStrokeColor( + CXFA_Color(m_pThemeData->clrDatesCircle)); pParams->m_pGraphics->StrokePath(&path, pMatrix); pParams->m_pGraphics->RestoreGraphState(); } @@ -267,8 +257,8 @@ void CFWL_MonthCalendarTP::DrawTodayCircle(CFWL_ThemeBackground* pParams, path.AddRectangle(rtTodayCircle.left, rtTodayCircle.top, rtTodayCircle.width, rtTodayCircle.height); pParams->m_pGraphics->SaveGraphState(); - CXFA_Color clrTodayCircle(m_pThemeData->clrDatesCircle); - pParams->m_pGraphics->SetStrokeColor(&clrTodayCircle); + pParams->m_pGraphics->SetStrokeColor( + CXFA_Color(m_pThemeData->clrDatesCircle)); pParams->m_pGraphics->StrokePath(&path, pMatrix); pParams->m_pGraphics->RestoreGraphState(); } diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp index d0f5760f44..c8152f8d9b 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp +++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp @@ -67,16 +67,14 @@ void CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { m_pThemeData->clrEnd[iColor], &fillPath, FXFILL_ALTERNATE, &pParams->m_matrix); - CXFA_Color crStroke(m_pThemeData->clrBorder[iColor]); - pGraphics->SetStrokeColor(&crStroke); + pGraphics->SetStrokeColor(CXFA_Color(m_pThemeData->clrBorder[iColor])); pGraphics->StrokePath(&strokePath, &pParams->m_matrix); fillPath.Clear(); fillPath.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height); - CXFA_Color crFill(m_pThemeData->clrFill[iColor]); - pGraphics->SetFillColor(&crFill); + pGraphics->SetFillColor(CXFA_Color(m_pThemeData->clrFill[iColor])); pGraphics->FillPath(&fillPath, FXFILL_WINDING, &pParams->m_matrix); if (pParams->m_dwStates & CFWL_PartState_Focused) { rtInner.Inflate(1, 1, 0, 0); diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index 2975888ac2..5deec8d6d6 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp @@ -92,10 +92,9 @@ void CFWL_ScrollBarTP::DrawThumbBtn(CXFA_Graphics* pGraphics, m_pThemeData->clrBtnBK[eState - 1][0], m_pThemeData->clrBtnBK[eState - 1][1], &path, FXFILL_WINDING, pMatrix); - CXFA_Color rcStroke; - rcStroke.Set(m_pThemeData->clrBtnBorder[eState - 1]); pGraphics->SaveGraphState(); - pGraphics->SetStrokeColor(&rcStroke); + pGraphics->SetStrokeColor( + CXFA_Color(m_pThemeData->clrBtnBorder[eState - 1])); pGraphics->StrokePath(&path, pMatrix); pGraphics->RestoreGraphState(); } else { @@ -108,10 +107,9 @@ void CFWL_ScrollBarTP::DrawThumbBtn(CXFA_Graphics* pGraphics, m_pThemeData->clrBtnBK[eState - 1][0], m_pThemeData->clrBtnBK[eState - 1][1], &path, FXFILL_WINDING, pMatrix); - CXFA_Color rcStroke; - rcStroke.Set(m_pThemeData->clrBtnBorder[eState - 1]); pGraphics->SaveGraphState(); - pGraphics->SetStrokeColor(&rcStroke); + pGraphics->SetStrokeColor( + CXFA_Color(m_pThemeData->clrBtnBorder[eState - 1])); pGraphics->StrokePath(&path, pMatrix); pGraphics->RestoreGraphState(); } @@ -140,9 +138,9 @@ void CFWL_ScrollBarTP::DrawPaw(CXFA_Graphics* pGraphics, path.MoveTo(CFX_PointF(fX, fY + 2)); path.LineTo(CFX_PointF(fX + fPawLen, fY + 2)); - CXFA_Color clrLight(m_pThemeData->clrPawColorLight[eState - 1]); pGraphics->SetLineWidth(1); - pGraphics->SetStrokeColor(&clrLight); + pGraphics->SetStrokeColor( + CXFA_Color(m_pThemeData->clrPawColorLight[eState - 1])); pGraphics->StrokePath(&path); fX++; @@ -156,9 +154,9 @@ void CFWL_ScrollBarTP::DrawPaw(CXFA_Graphics* pGraphics, path.MoveTo(CFX_PointF(fX, fY + 3)); path.LineTo(CFX_PointF(fX + fPawLen, fY + 3)); - CXFA_Color clrDark(m_pThemeData->clrPawColorDark[eState - 1]); pGraphics->SetLineWidth(1); - pGraphics->SetStrokeColor(&clrDark); + pGraphics->SetStrokeColor( + CXFA_Color(m_pThemeData->clrPawColorDark[eState - 1])); pGraphics->StrokePath(&path, pMatrix); } else { float fPawLen = kPawLength; @@ -177,9 +175,9 @@ void CFWL_ScrollBarTP::DrawPaw(CXFA_Graphics* pGraphics, path.MoveTo(CFX_PointF(fX + 2, fY)); path.LineTo(CFX_PointF(fX + 2, fY + fPawLen)); - CXFA_Color clrLight(m_pThemeData->clrPawColorLight[eState - 1]); pGraphics->SetLineWidth(1); - pGraphics->SetStrokeColor(&clrLight); + pGraphics->SetStrokeColor( + CXFA_Color(m_pThemeData->clrPawColorLight[eState - 1])); pGraphics->StrokePath(&path, pMatrix); fY++; @@ -193,9 +191,9 @@ void CFWL_ScrollBarTP::DrawPaw(CXFA_Graphics* pGraphics, path.MoveTo(CFX_PointF(fX + 3, fY)); path.LineTo(CFX_PointF(fX + 3, fY + fPawLen)); - CXFA_Color clrDark(m_pThemeData->clrPawColorDark[eState - 1]); pGraphics->SetLineWidth(1); - pGraphics->SetStrokeColor(&clrDark); + pGraphics->SetStrokeColor( + CXFA_Color(m_pThemeData->clrPawColorDark[eState - 1])); pGraphics->StrokePath(&path, pMatrix); } } @@ -210,7 +208,6 @@ void CFWL_ScrollBarTP::DrawTrack(CXFA_Graphics* pGraphics, return; pGraphics->SaveGraphState(); - CXFA_Color colorLine(ArgbEncode(255, 238, 237, 229)); CXFA_Path path; float fRight = pRect->right(); float fBottom = pRect->bottom(); @@ -221,7 +218,7 @@ void CFWL_ScrollBarTP::DrawTrack(CXFA_Graphics* pGraphics, path.AddRectangle(pRect->left, pRect->top, pRect->width, 1); path.AddRectangle(pRect->left, fBottom - 1, pRect->width, 1); } - pGraphics->SetFillColor(&colorLine); + pGraphics->SetFillColor(CXFA_Color(ArgbEncode(255, 238, 237, 229))); pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); path.Clear(); path.AddRectangle(pRect->left + 1, pRect->top, pRect->width - 2, diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index fe63780c39..48d4118ed9 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -98,17 +98,15 @@ void CFWL_WidgetTP::FinalizeTTO() { void CFWL_WidgetTP::DrawBorder(CXFA_Graphics* pGraphics, const CFX_RectF* pRect, CFX_Matrix* pMatrix) { - if (!pGraphics) - return; - if (!pRect) + if (!pGraphics || !pRect) return; + CXFA_Path 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); pGraphics->SaveGraphState(); - CXFA_Color crFill(ArgbEncode(255, 0, 0, 0)); - pGraphics->SetFillColor(&crFill); + pGraphics->SetFillColor(CXFA_Color(ArgbEncode(255, 0, 0, 0))); pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix); pGraphics->RestoreGraphState(); } @@ -123,15 +121,13 @@ void CFWL_WidgetTP::FillSoildRect(CXFA_Graphics* pGraphics, FX_ARGB fillColor, const CFX_RectF* pRect, CFX_Matrix* pMatrix) { - if (!pGraphics) + if (!pGraphics || !pRect) return; - if (!pRect) - return; - pGraphics->SaveGraphState(); - CXFA_Color crFill(fillColor); - pGraphics->SetFillColor(&crFill); + CXFA_Path path; path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); + pGraphics->SaveGraphState(); + pGraphics->SetFillColor(CXFA_Color(fillColor)); pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pGraphics->RestoreGraphState(); } @@ -153,8 +149,7 @@ void CFWL_WidgetTP::DrawAxialShading(CXFA_Graphics* pGraphics, CFX_PointF endPoint(fx2, fy2); CXFA_Shading shading(begPoint, endPoint, false, false, beginColor, endColor); pGraphics->SaveGraphState(); - CXFA_Color color1(&shading); - pGraphics->SetFillColor(&color1); + pGraphics->SetFillColor(CXFA_Color(&shading)); pGraphics->FillPath(path, fillMode, pMatrix); pGraphics->RestoreGraphState(); } @@ -162,17 +157,15 @@ void CFWL_WidgetTP::DrawAxialShading(CXFA_Graphics* pGraphics, void CFWL_WidgetTP::DrawFocus(CXFA_Graphics* pGraphics, const CFX_RectF* pRect, CFX_Matrix* pMatrix) { - if (!pGraphics) - return; - if (!pRect) + if (!pGraphics || !pRect) return; - pGraphics->SaveGraphState(); - CXFA_Color cr(0xFF000000); - pGraphics->SetStrokeColor(&cr); + float DashPattern[2] = {1, 1}; - pGraphics->SetLineDash(0.0f, DashPattern, 2); CXFA_Path path; path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); + pGraphics->SaveGraphState(); + pGraphics->SetStrokeColor(CXFA_Color(0xFF000000)); + pGraphics->SetLineDash(0.0f, DashPattern, 2); pGraphics->StrokePath(&path, pMatrix); pGraphics->RestoreGraphState(); } @@ -227,8 +220,7 @@ void CFWL_WidgetTP::DrawArrow(CXFA_Graphics* pGraphics, break; } } - CXFA_Color cr(argSign); - pGraphics->SetFillColor(&cr); + pGraphics->SetFillColor(CXFA_Color(argSign)); pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); } @@ -236,9 +228,9 @@ void CFWL_WidgetTP::DrawBtn(CXFA_Graphics* pGraphics, const CFX_RectF* pRect, FWLTHEME_STATE eState, CFX_Matrix* pMatrix) { - CXFA_Path path; InitializeArrowColorData(); + CXFA_Path path; float fRight = pRect->right(); float fBottom = pRect->bottom(); path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); @@ -247,9 +239,7 @@ void CFWL_WidgetTP::DrawBtn(CXFA_Graphics* pGraphics, m_pColorData->clrEnd[eState - 1], &path, FXFILL_WINDING, pMatrix); - CXFA_Color rcStroke; - rcStroke.Set(m_pColorData->clrBorder[eState - 1]); - pGraphics->SetStrokeColor(&rcStroke); + pGraphics->SetStrokeColor(CXFA_Color(m_pColorData->clrBorder[eState - 1])); pGraphics->StrokePath(&path, pMatrix); } |