From 4b47214ac95ee1ac7c09688363e48c3e6eb77ea8 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 17 Aug 2017 14:30:08 -0700 Subject: Change XFA DrawWidget() code to take its CFX_Matrix by const-ref. Change-Id: Idc9dfcafe6727c1689443ce8f9568567e55d51c8 Reviewed-on: https://pdfium-review.googlesource.com/11114 Commit-Queue: Lei Zhang Reviewed-by: dsinclair --- xfa/fwl/cfwl_widgetmgr.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'xfa/fwl/cfwl_widgetmgr.cpp') diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index d5b496a04b..f5beb411e6 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp @@ -419,7 +419,7 @@ void CFWL_WidgetMgr::OnProcessMessageToForm(CFWL_Message* pMessage) { void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget, CXFA_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { + const CFX_Matrix& matrix) { if (!pWidget || !pGraphics) return; @@ -430,22 +430,24 @@ void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget, if (IsFormDisabled()) { #endif // _FX_OS_ == _FX_MACOSX_ - pWidget->GetDelegate()->OnDrawWidget(pGraphics, pMatrix); + pWidget->GetDelegate()->OnDrawWidget(pGraphics, matrix); clipBounds = pGraphics->GetClipRect(); clipCopy = clipBounds; #if _FX_OS_ == _FX_MACOSX_ } else { - clipBounds = CFX_RectF(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d); - const_cast(pMatrix)->SetIdentity(); // FIXME: const cast. - pWidget->GetDelegate()->OnDrawWidget(pGraphics, pMatrix); + clipBounds = CFX_RectF(matrix.a, matrix.b, matrix.c, matrix.d); + // FIXME: const cast + CFX_Matrix* pMatrixHack = const_cast(&matrix); + pMatrixHack->SetIdentity(); + pWidget->GetDelegate()->OnDrawWidget(pGraphics, *pMatrixHack); } #endif // _FX_OS_ == _FX_MACOSX_ if (!IsFormDisabled()) clipBounds.Intersect(pWidget->GetClientRect()); if (!clipBounds.IsEmpty()) - DrawChild(pWidget, clipBounds, pGraphics, pMatrix); + DrawChild(pWidget, clipBounds, pGraphics, &matrix); GetWidgetMgrItem(pWidget)->iRedrawCounter = 0; ResetRedrawCounts(pWidget); @@ -492,7 +494,7 @@ void CFWL_WidgetMgr::DrawChild(CFWL_Widget* parent, if (IFWL_WidgetDelegate* pDelegate = child->GetDelegate()) { if (IsFormDisabled() || IsNeedRepaint(child, &widgetMatrix, rtClip)) - pDelegate->OnDrawWidget(pGraphics, &widgetMatrix); + pDelegate->OnDrawWidget(pGraphics, widgetMatrix); } if (!bFormDisable) pGraphics->RestoreGraphState(); -- cgit v1.2.3