Remove axial gradients from XFA widgets.

Most of the CPU time when moving around XFA forms is spent rendering
these gradients.

Bug: chromium:592748
Change-Id: I08c68c60996755a2be25243dfd2143b6cbb13af9
Reviewed-on: https://pdfium-review.googlesource.com/28090
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/DEPS b/DEPS
index e08aa2a..a36329a 100644
--- a/DEPS
+++ b/DEPS
@@ -29,7 +29,7 @@
   'jinja2_revision': 'd34383206fa42d52faa10bb9931d6d538f3a57e0',
   'jpeg_turbo_revision': '7260e4d8b8e1e40b17f03fafdf1cd83296900f76',
   'markupsafe_revision': '8f45f5cfa0009d2a70589bcda0349b8cb2b72783',
-  'pdfium_tests_revision': 'adcc738d124799800ab2f3eb7cf0dfbd301cd759',
+  'pdfium_tests_revision': 'b86c0ec9ee2aa3ba5e113a0e88a5c3292eb0fe2f',
   'skia_revision': '40ca2087ef0752d78fd2e0995471102fe96fe9fe',
   'tools_memory_revision': '427f10475e1a8d72424c29d00bf689122b738e5d',
   'trace_event_revision': '0e9a47d74970bee1bbfc063c47215406f8918699',
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index 3d3b1aa..c3eef0f 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -61,11 +61,8 @@
                             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);
+      FillSolidRect(pGraphics, m_pThemeData->clrEnd[iColor], &rect,
+                    &pParams->m_matrix);
 
       pGraphics->SetStrokeColor(CXFA_GEColor(m_pThemeData->clrBorder[iColor]));
       pGraphics->StrokePath(&strokePath, &pParams->m_matrix);
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index d94eed0..1e9ade8 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -80,39 +80,26 @@
   if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disable)
     return;
 
-  CXFA_GEPath path;
   CFX_RectF rect(*pRect);
-  if (bVert) {
+  if (bVert)
     rect.Deflate(1, 0);
-    if (rect.IsEmpty(0.1f))
-      return;
-
-    path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
-    DrawAxialShading(pGraphics, rect.left, rect.top, rect.right(), rect.top,
-                     m_pThemeData->clrBtnBK[eState - 1][0],
-                     m_pThemeData->clrBtnBK[eState - 1][1], &path,
-                     FXFILL_WINDING, pMatrix);
-    pGraphics->SaveGraphState();
-    pGraphics->SetStrokeColor(
-        CXFA_GEColor(m_pThemeData->clrBtnBorder[eState - 1]));
-    pGraphics->StrokePath(&path, pMatrix);
-    pGraphics->RestoreGraphState();
-  } else {
+  else
     rect.Deflate(0, 1);
-    if (rect.IsEmpty(0.1f))
-      return;
 
-    path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
-    DrawAxialShading(pGraphics, rect.left, rect.top, rect.left, rect.bottom(),
-                     m_pThemeData->clrBtnBK[eState - 1][0],
-                     m_pThemeData->clrBtnBK[eState - 1][1], &path,
-                     FXFILL_WINDING, pMatrix);
-    pGraphics->SaveGraphState();
-    pGraphics->SetStrokeColor(
-        CXFA_GEColor(m_pThemeData->clrBtnBorder[eState - 1]));
-    pGraphics->StrokePath(&path, pMatrix);
-    pGraphics->RestoreGraphState();
-  }
+  if (rect.IsEmpty(0.1f))
+    return;
+
+  FillSolidRect(pGraphics, m_pThemeData->clrBtnBK[eState - 1][1], &rect,
+                pMatrix);
+
+  pGraphics->SaveGraphState();
+
+  CXFA_GEPath path;
+  path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
+  pGraphics->SetStrokeColor(
+      CXFA_GEColor(m_pThemeData->clrBtnBorder[eState - 1]));
+  pGraphics->StrokePath(&path, pMatrix);
+  pGraphics->RestoreGraphState();
 }
 
 void CFWL_ScrollBarTP::DrawPaw(CXFA_Graphics* pGraphics,
@@ -223,13 +210,8 @@
   path.Clear();
   path.AddRectangle(pRect->left + 1, pRect->top, pRect->width - 2,
                     pRect->height);
-  float x1 = bVert ? pRect->left + 1 : pRect->left;
-  float y1 = bVert ? pRect->top : pRect->top + 1;
-  float x2 = bVert ? fRight - 1 : pRect->left;
-  float y2 = bVert ? pRect->top : fBottom - 1;
   pGraphics->RestoreGraphState();
-  DrawAxialShading(pGraphics, x1, y1, x2, y2, m_pThemeData->clrTrackBKStart,
-                   m_pThemeData->clrTrackBKEnd, &path, FXFILL_WINDING, pMatrix);
+  FillSolidRect(pGraphics, m_pThemeData->clrTrackBKEnd, pRect, pMatrix);
 }
 
 void CFWL_ScrollBarTP::DrawMaxMinBtn(CXFA_Graphics* pGraphics,
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index 9cbed0c..0f67b89 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -137,29 +137,6 @@
   pGraphics->RestoreGraphState();
 }
 
-void CFWL_WidgetTP::DrawAxialShading(CXFA_Graphics* pGraphics,
-                                     float fx1,
-                                     float fy1,
-                                     float fx2,
-                                     float fy2,
-                                     FX_ARGB beginColor,
-                                     FX_ARGB endColor,
-                                     CXFA_GEPath* path,
-                                     int32_t fillMode,
-                                     CFX_Matrix* pMatrix) {
-  if (!pGraphics || !path)
-    return;
-
-  CFX_PointF begPoint(fx1, fy1);
-  CFX_PointF endPoint(fx2, fy2);
-  CXFA_GEShading shading(begPoint, endPoint, false, false, beginColor,
-                         endColor);
-  pGraphics->SaveGraphState();
-  pGraphics->SetFillColor(CXFA_GEColor(&shading));
-  pGraphics->FillPath(path, fillMode, pMatrix);
-  pGraphics->RestoreGraphState();
-}
-
 void CFWL_WidgetTP::DrawFocus(CXFA_Graphics* pGraphics,
                               const CFX_RectF* pRect,
                               CFX_Matrix* pMatrix) {
@@ -236,15 +213,10 @@
                             CFX_Matrix* pMatrix) {
   InitializeArrowColorData();
 
-  CXFA_GEPath path;
-  float fRight = pRect->right();
-  float fBottom = pRect->bottom();
-  path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
-  DrawAxialShading(pGraphics, pRect->left, pRect->top, fRight, fBottom,
-                   m_pColorData->clrStart[eState - 1],
-                   m_pColorData->clrEnd[eState - 1], &path, FXFILL_WINDING,
-                   pMatrix);
+  FillSolidRect(pGraphics, m_pColorData->clrEnd[eState - 1], pRect, pMatrix);
 
+  CXFA_GEPath path;
+  path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
   pGraphics->SetStrokeColor(CXFA_GEColor(m_pColorData->clrBorder[eState - 1]));
   pGraphics->StrokePath(&path, pMatrix);
 }
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h
index 503c85e..f62098d 100644
--- a/xfa/fwl/theme/cfwl_widgettp.h
+++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -64,16 +64,6 @@
                      FX_ARGB fillColor,
                      const CFX_RectF* pRect,
                      CFX_Matrix* pMatrix = nullptr);
-  void DrawAxialShading(CXFA_Graphics* pGraphics,
-                        float fx1,
-                        float fy1,
-                        float fx2,
-                        float fy2,
-                        FX_ARGB beginColor,
-                        FX_ARGB endColor,
-                        CXFA_GEPath* path,
-                        int32_t fillMode = FXFILL_WINDING,
-                        CFX_Matrix* pMatrix = nullptr);
   void DrawFocus(CXFA_Graphics* pGraphics,
                  const CFX_RectF* pRect,
                  CFX_Matrix* pMatrix = nullptr);