summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_widgetmgr.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-07 16:36:39 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-08 01:36:02 +0000
commitbba2a7cf30da9e84bcc14ef32dbb0bb944229219 (patch)
tree94a74de8d07b3e395bf6e08a62811a3a0d652d19 /xfa/fwl/cfwl_widgetmgr.cpp
parent55e026b7b6eec17b012c819c4a7d39e63094b5c4 (diff)
downloadpdfium-bba2a7cf30da9e84bcc14ef32dbb0bb944229219.tar.xz
Update to use CFX_Rect{F} and CFX_Matrix constructors.
This Cl updates the code to use the constructors instead of creating an empty object and calling Set(). It also removes the various memsets of the CFX_Rect{F} classes. Change-Id: I6e20cec00866a38372858dcba5a30d31103172e4 Reviewed-on: https://pdfium-review.googlesource.com/2550 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fwl/cfwl_widgetmgr.cpp')
-rw-r--r--xfa/fwl/cfwl_widgetmgr.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index cd9c3e609d..6e537a4ad9 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -267,9 +267,10 @@ CFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(CFWL_Widget* parent,
if ((child->GetStates() & FWL_WGTSTATE_Invisible) == 0) {
x1 = x;
y1 = y;
- CFX_Matrix matrixOnParent;
CFX_Matrix m;
m.SetIdentity();
+
+ CFX_Matrix matrixOnParent;
m.SetReverse(matrixOnParent);
m.TransformPoint(x1, y1);
CFX_RectF bounds = child->GetWidgetRect();
@@ -428,9 +429,7 @@ void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget,
if (!pWidget || !pGraphics)
return;
- CFX_RectF clipCopy = pWidget->GetWidgetRect();
- clipCopy.left = clipCopy.top = 0;
-
+ CFX_RectF clipCopy(0, 0, pWidget->GetWidgetRect().Size());
CFX_RectF clipBounds;
#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ || \
@@ -444,7 +443,7 @@ void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget,
pGraphics->GetClipRect(clipBounds);
clipCopy = clipBounds;
} else {
- clipBounds.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d);
+ clipBounds = CFX_RectF(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d);
const_cast<CFX_Matrix*>(pMatrix)->SetIdentity(); // FIXME: const cast.
pWidget->GetDelegate()->OnDrawWidget(pGraphics, pMatrix);
}
@@ -518,8 +517,7 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget,
return true;
}
- CFX_RectF rtWidget = pWidget->GetWidgetRect();
- rtWidget.left = rtWidget.top = 0;
+ CFX_RectF rtWidget(0, 0, pWidget->GetWidgetRect().Size());
pMatrix->TransformRect(rtWidget);
if (!rtWidget.IntersectWith(rtDirty))
return false;
@@ -530,7 +528,6 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget,
return true;
CFX_RectF rtChilds;
- rtChilds.Empty();
bool bChildIntersectWithDirty = false;
bool bOrginPtIntersectWidthChild = false;
bool bOrginPtIntersectWidthDirty =
@@ -555,9 +552,8 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget,
rtWidget.height + rtWidget.top;
do {
CFX_RectF rect = pChild->GetWidgetRect();
- CFX_RectF r = rect;
- r.left += rtWidget.left;
- r.top += rtWidget.top;
+ CFX_RectF r(rect.left + rtWidget.left, rect.top + rtWidget.top, rect.width,
+ rect.height);
if (r.IsEmpty())
continue;
if (r.Contains(rtDirty))