summaryrefslogtreecommitdiff
path: root/xfa/fwl/theme/cfwl_pushbuttontp.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-02-22 19:56:15 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-23 01:17:40 +0000
commitb147e07ee36be10ca0796a6566be107077c21a03 (patch)
tree637b1b206000a88fb3e198f648e86a9ee5178f1b /xfa/fwl/theme/cfwl_pushbuttontp.cpp
parente3f237740fd8bea50b4a6f37f56455dfa0328546 (diff)
downloadpdfium-b147e07ee36be10ca0796a6566be107077c21a03.tar.xz
Convert point x,y into CFX_PointF
This Cl converts the PointX,PointY pairs into a CFX_PointF. Change-Id: I46897832077c317a5bffb4e568550705decbc40c Reviewed-on: https://pdfium-review.googlesource.com/2821 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fwl/theme/cfwl_pushbuttontp.cpp')
-rw-r--r--xfa/fwl/theme/cfwl_pushbuttontp.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index a1e57836fa..ba7b2ca506 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -31,39 +31,52 @@ void CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) {
CFX_RectF& rect = pParams->m_rtPart;
FX_FLOAT fRight = rect.right();
FX_FLOAT fBottom = rect.bottom();
+
CFX_Path strokePath;
strokePath.Create();
- strokePath.MoveTo(rect.left + PUSHBUTTON_SIZE_Corner, rect.top);
- strokePath.LineTo(fRight - PUSHBUTTON_SIZE_Corner, rect.top);
- strokePath.LineTo(fRight, rect.top + PUSHBUTTON_SIZE_Corner);
- strokePath.LineTo(fRight, fBottom - PUSHBUTTON_SIZE_Corner);
- strokePath.LineTo(fRight - PUSHBUTTON_SIZE_Corner, fBottom);
- strokePath.LineTo(rect.left + PUSHBUTTON_SIZE_Corner, fBottom);
- strokePath.LineTo(rect.left, fBottom - PUSHBUTTON_SIZE_Corner);
- strokePath.LineTo(rect.left, rect.top + PUSHBUTTON_SIZE_Corner);
- strokePath.LineTo(rect.left + PUSHBUTTON_SIZE_Corner, rect.top);
+ strokePath.MoveTo(
+ CFX_PointF(rect.left + PUSHBUTTON_SIZE_Corner, rect.top));
+ strokePath.LineTo(CFX_PointF(fRight - PUSHBUTTON_SIZE_Corner, rect.top));
+ strokePath.LineTo(CFX_PointF(fRight, rect.top + PUSHBUTTON_SIZE_Corner));
+ strokePath.LineTo(CFX_PointF(fRight, fBottom - PUSHBUTTON_SIZE_Corner));
+ strokePath.LineTo(CFX_PointF(fRight - PUSHBUTTON_SIZE_Corner, fBottom));
+ strokePath.LineTo(
+ CFX_PointF(rect.left + PUSHBUTTON_SIZE_Corner, fBottom));
+ strokePath.LineTo(
+ CFX_PointF(rect.left, fBottom - PUSHBUTTON_SIZE_Corner));
+ strokePath.LineTo(
+ CFX_PointF(rect.left, rect.top + PUSHBUTTON_SIZE_Corner));
+ strokePath.LineTo(
+ CFX_PointF(rect.left + PUSHBUTTON_SIZE_Corner, rect.top));
+
CFX_Path fillPath;
fillPath.Create();
fillPath.AddSubpath(&strokePath);
+
CFX_Graphics* pGraphics = pParams->m_pGraphics;
pGraphics->SaveGraphState();
+
CFX_RectF rtInner(rect);
rtInner.Deflate(PUSHBUTTON_SIZE_Corner + 1, PUSHBUTTON_SIZE_Corner + 1,
PUSHBUTTON_SIZE_Corner, PUSHBUTTON_SIZE_Corner);
fillPath.AddRectangle(rtInner.left, rtInner.top, rtInner.width,
rtInner.height);
+
int32_t iColor = GetColorID(pParams->m_dwStates);
DrawAxialShading(pGraphics, rect.left + PUSHBUTTON_SIZE_Corner, rect.top,
rect.left + PUSHBUTTON_SIZE_Corner, rect.bottom(),
m_pThemeData->clrStart[iColor],
m_pThemeData->clrEnd[iColor], &fillPath,
FXFILL_ALTERNATE, &pParams->m_matrix);
+
CFX_Color crStroke(m_pThemeData->clrBorder[iColor]);
pGraphics->SetStrokeColor(&crStroke);
pGraphics->StrokePath(&strokePath, &pParams->m_matrix);
+
fillPath.Clear();
fillPath.AddRectangle(rtInner.left, rtInner.top, rtInner.width,
rtInner.height);
+
CFX_Color crFill(m_pThemeData->clrFill[iColor]);
pGraphics->SetFillColor(&crFill);
pGraphics->FillPath(&fillPath, FXFILL_WINDING, &pParams->m_matrix);