From 574015e0ad53c592fe8a923390b31edeb30c41fe Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 16 Aug 2017 15:09:00 -0700 Subject: 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 Commit-Queue: Tom Sepez --- xfa/fwl/theme/cfwl_checkboxtp.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'xfa/fwl/theme/cfwl_checkboxtp.cpp') 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(); } -- cgit v1.2.3