Pass CFX_Matrix by const-ref in xfa/

Change-Id: Ic182b0060533fcce282c411ad267d7330b8450a5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79351
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fwl/cfwl_caret.cpp b/xfa/fwl/cfwl_caret.cpp
index 8503872..db82ac8 100644
--- a/xfa/fwl/cfwl_caret.cpp
+++ b/xfa/fwl/cfwl_caret.cpp
@@ -42,7 +42,7 @@
   if (!pGraphics)
     return;
 
-  DrawCaretBK(pGraphics, &matrix);
+  DrawCaretBK(pGraphics, matrix);
 }
 
 void CFWL_Caret::ShowCaret() {
@@ -58,7 +58,7 @@
 }
 
 void CFWL_Caret::DrawCaretBK(CFGAS_GEGraphics* pGraphics,
-                             const CFX_Matrix* pMatrix) {
+                             const CFX_Matrix& mtMatrix) {
   if (!(m_Properties.m_dwStates & kStateHighlight))
     return;
 
@@ -68,9 +68,7 @@
   param.m_PartRect = CFX_RectF(0, 0, GetWidgetRect().Size());
   param.m_iPart = CFWL_Part::Background;
   param.m_dwStates = CFWL_PartState_HightLight;
-  if (pMatrix)
-    param.m_matrix.Concat(*pMatrix);
-
+  param.m_matrix.Concat(mtMatrix);
   GetThemeProvider()->DrawBackground(param);
 }
 
diff --git a/xfa/fwl/cfwl_caret.h b/xfa/fwl/cfwl_caret.h
index b59637e..e3dc455 100644
--- a/xfa/fwl/cfwl_caret.h
+++ b/xfa/fwl/cfwl_caret.h
@@ -36,7 +36,7 @@
  private:
   CFWL_Caret(CFWL_App* app, const Properties& properties, CFWL_Widget* pOuter);
 
-  void DrawCaretBK(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
+  void DrawCaretBK(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
 
   std::unique_ptr<CFX_Timer> m_pTimer;
 };
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index 03b50ca..ac48d92 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -101,7 +101,7 @@
     DrawBorder(pGraphics, CFWL_Part::Border, matrix);
 
   if (!m_BtnRect.IsEmpty())
-    DrawDropDownButton(pGraphics, &matrix);
+    DrawDropDownButton(pGraphics, matrix);
 
   if (m_pEdit) {
     CFX_RectF rtEdit = m_pEdit->GetWidgetRect();
@@ -180,15 +180,14 @@
 }
 
 void CFWL_DateTimePicker::DrawDropDownButton(CFGAS_GEGraphics* pGraphics,
-                                             const CFX_Matrix* pMatrix) {
+                                             const CFX_Matrix& mtMatrix) {
   CFWL_ThemeBackground param;
   param.m_pWidget = this;
   param.m_iPart = CFWL_Part::DropDownButton;
   param.m_dwStates = m_iBtnState;
   param.m_pGraphics = pGraphics;
   param.m_PartRect = m_BtnRect;
-  if (pMatrix)
-    param.m_matrix.Concat(*pMatrix);
+  param.m_matrix.Concat(mtMatrix);
   GetThemeProvider()->DrawBackground(param);
 }
 
diff --git a/xfa/fwl/cfwl_datetimepicker.h b/xfa/fwl/cfwl_datetimepicker.h
index 5a3f6c4..bc55bf1 100644
--- a/xfa/fwl/cfwl_datetimepicker.h
+++ b/xfa/fwl/cfwl_datetimepicker.h
@@ -80,7 +80,7 @@
   explicit CFWL_DateTimePicker(CFWL_App* pApp);
 
   void DrawDropDownButton(CFGAS_GEGraphics* pGraphics,
-                          const CFX_Matrix* pMatrix);
+                          const CFX_Matrix& mtMatrix);
   WideString FormatDateString(int32_t iYear, int32_t iMonth, int32_t iDay);
   void ResetEditAlignment();
   void GetPopupPos(float fMinHeight,
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 9a44b6c..76eb9ba 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -148,7 +148,7 @@
   if (m_ClientRect.IsEmpty())
     return;
 
-  DrawContent(pGraphics, &matrix);
+  DrawContent(pGraphics, matrix);
   if (HasBorder())
     DrawBorder(pGraphics, CFWL_Part::Border, matrix);
 }
@@ -323,7 +323,7 @@
 }
 
 void CFWL_Edit::DrawContent(CFGAS_GEGraphics* pGraphics,
-                            const CFX_Matrix* pMatrix) {
+                            const CFX_Matrix& mtMatrix) {
   pGraphics->SaveGraphState();
   if (m_Properties.m_dwStyleExes & FWL_STYLEEXT_EDT_CombText)
     pGraphics->SaveGraphState();
@@ -333,10 +333,8 @@
   float fOffSetY = m_EngineRect.top - m_fScrollOffsetY + m_fVAlignOffset;
 
   CFX_Matrix mt(1, 0, 0, 1, fOffSetX, fOffSetY);
-  if (pMatrix) {
-    rtClip = pMatrix->TransformRect(rtClip);
-    mt.Concat(*pMatrix);
-  }
+  rtClip = mtMatrix.TransformRect(rtClip);
+  mt.Concat(mtMatrix);
 
   bool bShowSel = !!(m_Properties.m_dwStates & FWL_WGTSTATE_Focused);
   if (bShowSel && m_pEditEngine->HasSelection()) {
@@ -356,7 +354,7 @@
 
     CFWL_ThemeBackground param;
     param.m_pGraphics = pGraphics;
-    param.m_matrix = *pMatrix;
+    param.m_matrix = mtMatrix;
     param.m_pWidget = this;
     param.m_iPart = CFWL_Part::Background;
     param.m_pPath = &path;
@@ -381,7 +379,7 @@
 
     CFWL_ThemeBackground param;
     param.m_pGraphics = pGraphics;
-    param.m_matrix = *pMatrix;
+    param.m_matrix = mtMatrix;
     param.m_pWidget = this;
     param.m_iPart = CFWL_Part::CombTextLine;
     param.m_pPath = &path;
diff --git a/xfa/fwl/cfwl_edit.h b/xfa/fwl/cfwl_edit.h
index 27865d8..07e3ed1 100644
--- a/xfa/fwl/cfwl_edit.h
+++ b/xfa/fwl/cfwl_edit.h
@@ -108,7 +108,7 @@
   void RenderText(CFX_RenderDevice* pRenderDev,
                   const CFX_RectF& clipRect,
                   const CFX_Matrix& mt);
-  void DrawContent(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
+  void DrawContent(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
 
   void UpdateEditEngine();
   void UpdateEditParams();
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index 9f1c32a..a0d925e 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -100,9 +100,9 @@
 
   pGraphics->SetClipRect(matrix.TransformRect(rtClip));
   if ((m_Properties.m_dwStyles & FWL_WGTSTYLE_NoBackground) == 0)
-    DrawBkground(pGraphics, &matrix);
+    DrawBkground(pGraphics, matrix);
 
-  DrawItems(pGraphics, &matrix);
+  DrawItems(pGraphics, matrix);
   pGraphics->RestoreGraphState();
 }
 
@@ -328,7 +328,7 @@
 }
 
 void CFWL_ListBox::DrawBkground(CFGAS_GEGraphics* pGraphics,
-                                const CFX_Matrix* pMatrix) {
+                                const CFX_Matrix& mtMatrix) {
   if (!pGraphics)
     return;
 
@@ -337,7 +337,7 @@
   param.m_iPart = CFWL_Part::Background;
   param.m_dwStates = 0;
   param.m_pGraphics = pGraphics;
-  param.m_matrix.Concat(*pMatrix);
+  param.m_matrix.Concat(mtMatrix);
   param.m_PartRect = m_ClientRect;
   if (IsShowScrollBar(false) && IsShowScrollBar(true))
     param.m_pRtData = &m_StaticRect;
@@ -347,7 +347,7 @@
 }
 
 void CFWL_ListBox::DrawItems(CFGAS_GEGraphics* pGraphics,
-                             const CFX_Matrix* pMatrix) {
+                             const CFX_Matrix& mtMatrix) {
   float fPosX = 0.0f;
   if (m_pHorzScrollBar)
     fPosX = m_pHorzScrollBar->GetPos();
@@ -374,7 +374,7 @@
       continue;
     if (rtItem.top >= m_ContentRect.bottom())
       break;
-    DrawItem(pGraphics, pItem, i, rtItem, pMatrix);
+    DrawItem(pGraphics, pItem, i, rtItem, mtMatrix);
   }
 }
 
@@ -382,7 +382,7 @@
                             Item* pItem,
                             int32_t Index,
                             const CFX_RectF& rtItem,
-                            const CFX_Matrix* pMatrix) {
+                            const CFX_Matrix& mtMatrix) {
   uint32_t dwItemStyles = pItem ? pItem->GetStates() : 0;
   uint32_t dwPartStates = CFWL_PartState_Normal;
   if (m_Properties.m_dwStates & FWL_WGTSTATE_Disabled)
@@ -401,7 +401,7 @@
   bg_param.m_iPart = CFWL_Part::ListItem;
   bg_param.m_dwStates = dwPartStates;
   bg_param.m_pGraphics = pGraphics;
-  bg_param.m_matrix.Concat(*pMatrix);
+  bg_param.m_matrix.Concat(mtMatrix);
   bg_param.m_PartRect = rtItem;
   bg_param.m_bMaximize = true;
   bg_param.m_pRtData = &rtFocus;
@@ -429,7 +429,7 @@
   textParam.m_iPart = CFWL_Part::ListItem;
   textParam.m_dwStates = dwPartStates;
   textParam.m_pGraphics = pGraphics;
-  textParam.m_matrix.Concat(*pMatrix);
+  textParam.m_matrix.Concat(mtMatrix);
   textParam.m_PartRect = rtText;
   textParam.m_wsText = std::move(wsText);
   textParam.m_dwTTOStyles = m_TTOStyles;
diff --git a/xfa/fwl/cfwl_listbox.h b/xfa/fwl/cfwl_listbox.h
index 5576154..ee8df3f 100644
--- a/xfa/fwl/cfwl_listbox.h
+++ b/xfa/fwl/cfwl_listbox.h
@@ -98,13 +98,13 @@
   void SelectAll();
   Item* GetFocusedItem();
   void SetFocusItem(Item* hItem);
-  void DrawBkground(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
-  void DrawItems(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
+  void DrawBkground(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
+  void DrawItems(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
   void DrawItem(CFGAS_GEGraphics* pGraphics,
                 Item* hItem,
                 int32_t Index,
                 const CFX_RectF& rtItem,
-                const CFX_Matrix* pMatrix);
+                const CFX_Matrix& pMatrix);
   void DrawStatic(CFGAS_GEGraphics* pGraphics);
   CFX_SizeF CalcSize(bool bAutoSize);
   void UpdateItemSize(Item* hItem,
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp
index 919f8bb..3e69428 100644
--- a/xfa/fwl/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -127,18 +127,18 @@
   if (HasBorder())
     DrawBorder(pGraphics, CFWL_Part::Border, matrix);
 
-  DrawBackground(pGraphics, &matrix);
-  DrawHeadBK(pGraphics, &matrix);
-  DrawLButton(pGraphics, &matrix);
-  DrawRButton(pGraphics, &matrix);
-  DrawSeparator(pGraphics, &matrix);
-  DrawDatesInBK(pGraphics, &matrix);
-  DrawDatesInCircle(pGraphics, &matrix);
-  DrawCaption(pGraphics, &matrix);
-  DrawWeek(pGraphics, &matrix);
-  DrawDatesIn(pGraphics, &matrix);
-  DrawDatesOut(pGraphics, &matrix);
-  DrawToday(pGraphics, &matrix);
+  DrawBackground(pGraphics, matrix);
+  DrawHeadBK(pGraphics, matrix);
+  DrawLButton(pGraphics, matrix);
+  DrawRButton(pGraphics, matrix);
+  DrawSeparator(pGraphics, matrix);
+  DrawDatesInBK(pGraphics, matrix);
+  DrawDatesInCircle(pGraphics, matrix);
+  DrawCaption(pGraphics, matrix);
+  DrawWeek(pGraphics, matrix);
+  DrawDatesIn(pGraphics, matrix);
+  DrawDatesOut(pGraphics, matrix);
+  DrawToday(pGraphics, matrix);
 }
 
 void CFWL_MonthCalendar::SetSelect(int32_t iYear,
@@ -149,59 +149,55 @@
 }
 
 void CFWL_MonthCalendar::DrawBackground(CFGAS_GEGraphics* pGraphics,
-                                        const CFX_Matrix* pMatrix) {
+                                        const CFX_Matrix& mtMatrix) {
   CFWL_ThemeBackground params;
   params.m_pWidget = this;
   params.m_iPart = CFWL_Part::Background;
   params.m_pGraphics = pGraphics;
   params.m_dwStates = CFWL_PartState_Normal;
   params.m_PartRect = m_ClientRect;
-  if (pMatrix)
-    params.m_matrix.Concat(*pMatrix);
+  params.m_matrix.Concat(mtMatrix);
   GetThemeProvider()->DrawBackground(params);
 }
 
 void CFWL_MonthCalendar::DrawHeadBK(CFGAS_GEGraphics* pGraphics,
-                                    const CFX_Matrix* pMatrix) {
+                                    const CFX_Matrix& mtMatrix) {
   CFWL_ThemeBackground params;
   params.m_pWidget = this;
   params.m_iPart = CFWL_Part::Header;
   params.m_pGraphics = pGraphics;
   params.m_dwStates = CFWL_PartState_Normal;
   params.m_PartRect = m_HeadRect;
-  if (pMatrix)
-    params.m_matrix.Concat(*pMatrix);
+  params.m_matrix.Concat(mtMatrix);
   GetThemeProvider()->DrawBackground(params);
 }
 
 void CFWL_MonthCalendar::DrawLButton(CFGAS_GEGraphics* pGraphics,
-                                     const CFX_Matrix* pMatrix) {
+                                     const CFX_Matrix& mtMatrix) {
   CFWL_ThemeBackground params;
   params.m_pWidget = this;
   params.m_iPart = CFWL_Part::LBtn;
   params.m_pGraphics = pGraphics;
   params.m_dwStates = m_iLBtnPartStates;
   params.m_PartRect = m_LBtnRect;
-  if (pMatrix)
-    params.m_matrix.Concat(*pMatrix);
+  params.m_matrix.Concat(mtMatrix);
   GetThemeProvider()->DrawBackground(params);
 }
 
 void CFWL_MonthCalendar::DrawRButton(CFGAS_GEGraphics* pGraphics,
-                                     const CFX_Matrix* pMatrix) {
+                                     const CFX_Matrix& mtMatrix) {
   CFWL_ThemeBackground params;
   params.m_pWidget = this;
   params.m_iPart = CFWL_Part::RBtn;
   params.m_pGraphics = pGraphics;
   params.m_dwStates = m_iRBtnPartStates;
   params.m_PartRect = m_RBtnRect;
-  if (pMatrix)
-    params.m_matrix.Concat(*pMatrix);
+  params.m_matrix.Concat(mtMatrix);
   GetThemeProvider()->DrawBackground(params);
 }
 
 void CFWL_MonthCalendar::DrawCaption(CFGAS_GEGraphics* pGraphics,
-                                     const CFX_Matrix* pMatrix) {
+                                     const CFX_Matrix& mtMatrix) {
   CFWL_ThemeText textParam;
   textParam.m_pWidget = this;
   textParam.m_iPart = CFWL_Part::Caption;
@@ -213,32 +209,29 @@
   textParam.m_PartRect = m_HeadTextRect;
   textParam.m_dwTTOStyles.single_line_ = true;
   textParam.m_iTTOAlign = FDE_TextAlignment::kCenter;
-  if (pMatrix)
-    textParam.m_matrix.Concat(*pMatrix);
+  textParam.m_matrix.Concat(mtMatrix);
   GetThemeProvider()->DrawText(textParam);
 }
 
 void CFWL_MonthCalendar::DrawSeparator(CFGAS_GEGraphics* pGraphics,
-                                       const CFX_Matrix* pMatrix) {
+                                       const CFX_Matrix& mtMatrix) {
   CFWL_ThemeBackground params;
   params.m_pWidget = this;
   params.m_iPart = CFWL_Part::HSeparator;
   params.m_pGraphics = pGraphics;
   params.m_dwStates = CFWL_PartState_Normal;
   params.m_PartRect = m_HSepRect;
-  if (pMatrix)
-    params.m_matrix.Concat(*pMatrix);
+  params.m_matrix.Concat(mtMatrix);
   GetThemeProvider()->DrawBackground(params);
 }
 
 void CFWL_MonthCalendar::DrawDatesInBK(CFGAS_GEGraphics* pGraphics,
-                                       const CFX_Matrix* pMatrix) {
+                                       const CFX_Matrix& mtMatrix) {
   CFWL_ThemeBackground params;
   params.m_pWidget = this;
   params.m_iPart = CFWL_Part::DateInBK;
   params.m_pGraphics = pGraphics;
-  if (pMatrix)
-    params.m_matrix.Concat(*pMatrix);
+  params.m_matrix.Concat(mtMatrix);
 
   IFWL_ThemeProvider* pTheme = GetThemeProvider();
   int32_t iCount = pdfium::CollectionSize<int32_t>(m_DateArray);
@@ -262,7 +255,7 @@
 }
 
 void CFWL_MonthCalendar::DrawWeek(CFGAS_GEGraphics* pGraphics,
-                                  const CFX_Matrix* pMatrix) {
+                                  const CFX_Matrix& mtMatrix) {
   CFWL_ThemeText params;
   params.m_pWidget = this;
   params.m_iPart = CFWL_Part::Week;
@@ -270,9 +263,7 @@
   params.m_dwStates = CFWL_PartState_Normal;
   params.m_iTTOAlign = FDE_TextAlignment::kCenter;
   params.m_dwTTOStyles.single_line_ = true;
-
-  if (pMatrix)
-    params.m_matrix.Concat(*pMatrix);
+  params.m_matrix.Concat(mtMatrix);
 
   IFWL_ThemeProvider* pTheme = GetThemeProvider();
   CFX_RectF rtDayOfWeek;
@@ -288,7 +279,7 @@
 }
 
 void CFWL_MonthCalendar::DrawToday(CFGAS_GEGraphics* pGraphics,
-                                   const CFX_Matrix* pMatrix) {
+                                   const CFX_Matrix& mtMatrix) {
   CFWL_ThemeText params;
   params.m_pWidget = this;
   params.m_iPart = CFWL_Part::Today;
@@ -300,21 +291,19 @@
   CalcTodaySize();
   params.m_PartRect = m_TodayRect;
   params.m_dwTTOStyles.single_line_ = true;
-  if (pMatrix)
-    params.m_matrix.Concat(*pMatrix);
+  params.m_matrix.Concat(mtMatrix);
   GetThemeProvider()->DrawText(params);
 }
 
 void CFWL_MonthCalendar::DrawDatesIn(CFGAS_GEGraphics* pGraphics,
-                                     const CFX_Matrix* pMatrix) {
+                                     const CFX_Matrix& mtMatrix) {
   CFWL_ThemeText params;
   params.m_pWidget = this;
   params.m_iPart = CFWL_Part::DatesIn;
   params.m_pGraphics = pGraphics;
   params.m_dwStates = CFWL_PartState_Normal;
   params.m_iTTOAlign = FDE_TextAlignment::kCenter;
-  if (pMatrix)
-    params.m_matrix.Concat(*pMatrix);
+  params.m_matrix.Concat(mtMatrix);
 
   IFWL_ThemeProvider* pTheme = GetThemeProvider();
   int32_t iCount = pdfium::CollectionSize<int32_t>(m_DateArray);
@@ -332,20 +321,19 @@
 }
 
 void CFWL_MonthCalendar::DrawDatesOut(CFGAS_GEGraphics* pGraphics,
-                                      const CFX_Matrix* pMatrix) {
+                                      const CFX_Matrix& mtMatrix) {
   CFWL_ThemeText params;
   params.m_pWidget = this;
   params.m_iPart = CFWL_Part::DatesOut;
   params.m_pGraphics = pGraphics;
   params.m_dwStates = CFWL_PartState_Normal;
   params.m_iTTOAlign = FDE_TextAlignment::kCenter;
-  if (pMatrix)
-    params.m_matrix.Concat(*pMatrix);
+  params.m_matrix.Concat(mtMatrix);
   GetThemeProvider()->DrawText(params);
 }
 
 void CFWL_MonthCalendar::DrawDatesInCircle(CFGAS_GEGraphics* pGraphics,
-                                           const CFX_Matrix* pMatrix) {
+                                           const CFX_Matrix& mtMatrix) {
   if (m_iMonth != m_iCurMonth || m_iYear != m_iCurYear)
     return;
 
@@ -362,8 +350,7 @@
   params.m_pGraphics = pGraphics;
   params.m_PartRect = pDate->rect;
   params.m_dwStates = CFWL_PartState_Normal;
-  if (pMatrix)
-    params.m_matrix.Concat(*pMatrix);
+  params.m_matrix.Concat(mtMatrix);
   GetThemeProvider()->DrawBackground(params);
 }
 
diff --git a/xfa/fwl/cfwl_monthcalendar.h b/xfa/fwl/cfwl_monthcalendar.h
index 08bb583..7b53850 100644
--- a/xfa/fwl/cfwl_monthcalendar.h
+++ b/xfa/fwl/cfwl_monthcalendar.h
@@ -90,19 +90,19 @@
                      const Properties& properties,
                      CFWL_Widget* pOuter);
 
-  void DrawBackground(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
-  void DrawHeadBK(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
-  void DrawLButton(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
-  void DrawRButton(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
-  void DrawCaption(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
-  void DrawSeparator(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
-  void DrawDatesInBK(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
-  void DrawWeek(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
-  void DrawToday(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
-  void DrawDatesIn(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
-  void DrawDatesOut(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
+  void DrawBackground(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
+  void DrawHeadBK(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
+  void DrawLButton(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
+  void DrawRButton(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
+  void DrawCaption(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
+  void DrawSeparator(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
+  void DrawDatesInBK(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
+  void DrawWeek(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
+  void DrawToday(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
+  void DrawDatesIn(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
+  void DrawDatesOut(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
   void DrawDatesInCircle(CFGAS_GEGraphics* pGraphics,
-                         const CFX_Matrix* pMatrix);
+                         const CFX_Matrix& mtMatrix);
   CFX_SizeF CalcSize();
   void Layout();
   void CalcHeadSize();
diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp
index 7f8e6e4..7e57c58 100644
--- a/xfa/fwl/cfwl_pushbutton.cpp
+++ b/xfa/fwl/cfwl_pushbutton.cpp
@@ -50,18 +50,17 @@
   if (HasBorder())
     DrawBorder(pGraphics, CFWL_Part::Border, matrix);
 
-  DrawBkground(pGraphics, &matrix);
+  DrawBkground(pGraphics, matrix);
 }
 
 void CFWL_PushButton::DrawBkground(CFGAS_GEGraphics* pGraphics,
-                                   const CFX_Matrix* pMatrix) {
+                                   const CFX_Matrix& matrix) {
   CFWL_ThemeBackground param;
   param.m_pWidget = this;
   param.m_iPart = CFWL_Part::Background;
   param.m_dwStates = GetPartStates();
   param.m_pGraphics = pGraphics;
-  if (pMatrix)
-    param.m_matrix.Concat(*pMatrix);
+  param.m_matrix.Concat(matrix);
   param.m_PartRect = m_ClientRect;
   if (m_Properties.m_dwStates & FWL_WGTSTATE_Focused)
     param.m_pRtData = &m_CaptionRect;
diff --git a/xfa/fwl/cfwl_pushbutton.h b/xfa/fwl/cfwl_pushbutton.h
index e0a8625..429e0d9 100644
--- a/xfa/fwl/cfwl_pushbutton.h
+++ b/xfa/fwl/cfwl_pushbutton.h
@@ -33,7 +33,7 @@
  private:
   explicit CFWL_PushButton(CFWL_App* pApp);
 
-  void DrawBkground(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
+  void DrawBkground(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
   uint32_t GetPartStates();
   void UpdateTextOutStyles();
   void OnFocusChanged(CFWL_Message* pMsg, bool bSet);
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp
index e564331..fd8ad7a 100644
--- a/xfa/fwl/cfwl_scrollbar.cpp
+++ b/xfa/fwl/cfwl_scrollbar.cpp
@@ -53,11 +53,11 @@
   if (HasBorder())
     DrawBorder(pGraphics, CFWL_Part::Border, matrix);
 
-  DrawTrack(pGraphics, true, &matrix);
-  DrawTrack(pGraphics, false, &matrix);
-  DrawArrowBtn(pGraphics, true, &matrix);
-  DrawArrowBtn(pGraphics, false, &matrix);
-  DrawThumb(pGraphics, &matrix);
+  DrawTrack(pGraphics, true, matrix);
+  DrawTrack(pGraphics, false, matrix);
+  DrawArrowBtn(pGraphics, true, matrix);
+  DrawArrowBtn(pGraphics, false, matrix);
+  DrawThumb(pGraphics, matrix);
 }
 
 void CFWL_ScrollBar::SetTrackPos(float fTrackPos) {
@@ -75,7 +75,7 @@
 
 void CFWL_ScrollBar::DrawTrack(CFGAS_GEGraphics* pGraphics,
                                bool bLower,
-                               const CFX_Matrix* pMatrix) {
+                               const CFX_Matrix& mtMatrix) {
   CFWL_ThemeBackground param;
   param.m_pWidget = this;
   param.m_iPart = bLower ? CFWL_Part::LowerTrack : CFWL_Part::UpperTrack;
@@ -83,14 +83,14 @@
                          ? CFWL_PartState_Disabled
                          : (bLower ? m_iMinTrackState : m_iMaxTrackState);
   param.m_pGraphics = pGraphics;
-  param.m_matrix.Concat(*pMatrix);
+  param.m_matrix.Concat(mtMatrix);
   param.m_PartRect = bLower ? m_MinTrackRect : m_MaxTrackRect;
   GetThemeProvider()->DrawBackground(param);
 }
 
 void CFWL_ScrollBar::DrawArrowBtn(CFGAS_GEGraphics* pGraphics,
                                   bool bMinBtn,
-                                  const CFX_Matrix* pMatrix) {
+                                  const CFX_Matrix& mtMatrix) {
   CFWL_ThemeBackground param;
   param.m_pWidget = this;
   param.m_iPart = bMinBtn ? CFWL_Part::ForeArrow : CFWL_Part::BackArrow;
@@ -98,14 +98,14 @@
                          ? CFWL_PartState_Disabled
                          : (bMinBtn ? m_iMinButtonState : m_iMaxButtonState);
   param.m_pGraphics = pGraphics;
-  param.m_matrix.Concat(*pMatrix);
+  param.m_matrix.Concat(mtMatrix);
   param.m_PartRect = bMinBtn ? m_MinBtnRect : m_MaxBtnRect;
   if (param.m_PartRect.height > 0 && param.m_PartRect.width > 0)
     GetThemeProvider()->DrawBackground(param);
 }
 
 void CFWL_ScrollBar::DrawThumb(CFGAS_GEGraphics* pGraphics,
-                               const CFX_Matrix* pMatrix) {
+                               const CFX_Matrix& mtMatrix) {
   CFWL_ThemeBackground param;
   param.m_pWidget = this;
   param.m_iPart = CFWL_Part::Thumb;
@@ -113,7 +113,7 @@
                          ? CFWL_PartState_Disabled
                          : m_iThumbButtonState;
   param.m_pGraphics = pGraphics;
-  param.m_matrix.Concat(*pMatrix);
+  param.m_matrix.Concat(mtMatrix);
   param.m_PartRect = m_ThumbRect;
   GetThemeProvider()->DrawBackground(param);
 }
diff --git a/xfa/fwl/cfwl_scrollbar.h b/xfa/fwl/cfwl_scrollbar.h
index 31fb4c9..b629807 100644
--- a/xfa/fwl/cfwl_scrollbar.h
+++ b/xfa/fwl/cfwl_scrollbar.h
@@ -64,11 +64,11 @@
   }
   void DrawTrack(CFGAS_GEGraphics* pGraphics,
                  bool bLower,
-                 const CFX_Matrix* pMatrix);
+                 const CFX_Matrix& mtMatrix);
   void DrawArrowBtn(CFGAS_GEGraphics* pGraphics,
                     bool bMinBtn,
-                    const CFX_Matrix* pMatrix);
-  void DrawThumb(CFGAS_GEGraphics* pGraphics, const CFX_Matrix* pMatrix);
+                    const CFX_Matrix& mtMatrix);
+  void DrawThumb(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
   void Layout();
   void CalcButtonLen();
   CFX_RectF CalcMinButtonRect();
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index 46aae70..63ad532 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -281,13 +281,12 @@
 
 void CFWL_Widget::DrawBackground(CFGAS_GEGraphics* pGraphics,
                                  CFWL_Part iPartBk,
-                                 const CFX_Matrix* pMatrix) {
+                                 const CFX_Matrix& mtMatrix) {
   CFWL_ThemeBackground param;
   param.m_pWidget = this;
   param.m_iPart = iPartBk;
   param.m_pGraphics = pGraphics;
-  if (pMatrix)
-    param.m_matrix = *pMatrix;
+  param.m_matrix = mtMatrix;
   param.m_PartRect = GetRelativeRect();
   GetThemeProvider()->DrawBackground(param);
 }
diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h
index 0b15a54..60939a0 100644
--- a/xfa/fwl/cfwl_widget.h
+++ b/xfa/fwl/cfwl_widget.h
@@ -178,7 +178,7 @@
   CFX_SizeF GetOffsetFromParent(CFWL_Widget* pParent);
   void DrawBackground(CFGAS_GEGraphics* pGraphics,
                       CFWL_Part iPartBk,
-                      const CFX_Matrix* pMatrix);
+                      const CFX_Matrix& mtMatrix);
   void NotifyDriver();
   bool IsParent(CFWL_Widget* pParent);
 
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index 5014192..86a23ae 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -199,13 +199,13 @@
 
   CFX_RectF clipBounds = pGraphics->GetClipRect();
   if (!clipBounds.IsEmpty())
-    DrawChildren(pWidget, clipBounds, pGraphics, &matrix);
+    DrawChildren(pWidget, clipBounds, pGraphics, matrix);
 }
 
 void CFWL_WidgetMgr::DrawChildren(CFWL_Widget* parent,
                                   const CFX_RectF& rtClip,
                                   CFGAS_GEGraphics* pGraphics,
-                                  const CFX_Matrix* pMatrix) {
+                                  const CFX_Matrix& mtMatrix) {
   if (!parent)
     return;
 
@@ -222,15 +222,13 @@
 
     CFX_Matrix widgetMatrix;
     CFX_RectF clipBounds(rtWidget);
-    if (pMatrix)
-      widgetMatrix.Concat(*pMatrix);
-
+    widgetMatrix.Concat(mtMatrix);
     widgetMatrix.TranslatePrepend(rtWidget.left, rtWidget.top);
 
     if (IFWL_WidgetDelegate* pDelegate = child->GetDelegate())
       pDelegate->OnDrawWidget(pGraphics, widgetMatrix);
 
-    DrawChildren(child, clipBounds, pGraphics, &widgetMatrix);
+    DrawChildren(child, clipBounds, pGraphics, widgetMatrix);
   }
 }
 
diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h
index 22b253b..b530440 100644
--- a/xfa/fwl/cfwl_widgetmgr.h
+++ b/xfa/fwl/cfwl_widgetmgr.h
@@ -93,7 +93,7 @@
   void DrawChildren(CFWL_Widget* pParent,
                     const CFX_RectF& rtClip,
                     CFGAS_GEGraphics* pGraphics,
-                    const CFX_Matrix* pMatrix);
+                    const CFX_Matrix& mtMatrix);
 
   cppgc::Member<AdapterIface> const m_pAdapter;
   cppgc::Member<CFWL_App> const m_pApp;
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index ab93a8a..ac34fc9 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -145,7 +145,7 @@
       CFX_Matrix(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top));
   mtImage.Concat(matrix);
 
-  CXFA_ImageRenderer imageRender(pRenderDevice, pDIBitmap, &mtImage);
+  CXFA_ImageRenderer imageRender(pRenderDevice, pDIBitmap, mtImage);
   if (!imageRender.Start()) {
     return;
   }
diff --git a/xfa/fxfa/cxfa_imagerenderer.cpp b/xfa/fxfa/cxfa_imagerenderer.cpp
index dd6f099..4407ca3 100644
--- a/xfa/fxfa/cxfa_imagerenderer.cpp
+++ b/xfa/fxfa/cxfa_imagerenderer.cpp
@@ -14,8 +14,8 @@
 
 CXFA_ImageRenderer::CXFA_ImageRenderer(CFX_RenderDevice* pDevice,
                                        const RetainPtr<CFX_DIBBase>& pDIBBase,
-                                       const CFX_Matrix* pImage2Device)
-    : m_pDevice(pDevice), m_ImageMatrix(*pImage2Device), m_pDIBBase(pDIBBase) {}
+                                       const CFX_Matrix& pImage2Device)
+    : m_pDevice(pDevice), m_ImageMatrix(pImage2Device), m_pDIBBase(pDIBBase) {}
 
 CXFA_ImageRenderer::~CXFA_ImageRenderer() = default;
 
@@ -148,8 +148,7 @@
   if (!pCloneConvert)
     return;
 
-  CXFA_ImageRenderer imageRender(m_pDevice.Get(), pCloneConvert,
-                                 &m_ImageMatrix);
+  CXFA_ImageRenderer imageRender(m_pDevice.Get(), pCloneConvert, m_ImageMatrix);
   if (!imageRender.Start())
     return;
 
diff --git a/xfa/fxfa/cxfa_imagerenderer.h b/xfa/fxfa/cxfa_imagerenderer.h
index 37e45d0..5d830bf 100644
--- a/xfa/fxfa/cxfa_imagerenderer.h
+++ b/xfa/fxfa/cxfa_imagerenderer.h
@@ -23,7 +23,7 @@
  public:
   CXFA_ImageRenderer(CFX_RenderDevice* pDevice,
                      const RetainPtr<CFX_DIBBase>& pDIBBase,
-                     const CFX_Matrix* pImage2Device);
+                     const CFX_Matrix& mtImage2Device);
   ~CXFA_ImageRenderer();
 
   bool Start();