summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_widget.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-12-08 19:45:00 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-08 19:45:00 -0800
commit1babeeed9c259b9d486b4cbee949253769d18fff (patch)
tree83a4e29dea3781a58f66d2b42427d1f18490b17a /xfa/fwl/cfwl_widget.cpp
parent94afac986c9d6232b7791acff4f23d99fbd004ae (diff)
downloadpdfium-1babeeed9c259b9d486b4cbee949253769d18fff.tar.xz
Change CFWL_Widget::GetMatrix to return the matrix
This CL switches to using a return value instead of an out parameter. The global flag was also removed and the call sites changed to just SetIdentity as appropriate. Review-Url: https://codereview.chromium.org/2564443003
Diffstat (limited to 'xfa/fwl/cfwl_widget.cpp')
-rw-r--r--xfa/fwl/cfwl_widget.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index 071e0ded8d..40b922395e 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -195,7 +195,7 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
r = GetWidgetRect();
fx += r.left;
fy += r.top;
- GetMatrix(m, true);
+ m = GetMatrix();
m.TransformPoint(fx, fy);
}
CFWL_Widget* form1 = m_pWidgetMgr->GetSystemFormWidget(this);
@@ -221,10 +221,8 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
}
parent = pWidget->GetParent();
if (parent) {
- pWidget->GetMatrix(m, true);
CFX_Matrix m1;
- m1.SetIdentity();
- m1.SetReverse(m);
+ m1.SetReverse(pWidget->GetMatrix());
m1.TransformPoint(fx, fy);
r = pWidget->GetWidgetRect();
fx -= r.left;
@@ -232,13 +230,9 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
}
}
-void CFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) {
+CFX_Matrix CFWL_Widget::GetMatrix() {
if (!m_pProperties)
- return;
- if (!bGlobal) {
- matrix.SetIdentity();
- return;
- }
+ return CFX_Matrix();
CFWL_Widget* parent = GetParent();
CFX_ArrayTemplate<CFWL_Widget*> parents;
@@ -246,13 +240,16 @@ void CFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) {
parents.Add(parent);
parent = parent->GetParent();
}
- matrix.SetIdentity();
+
+ CFX_Matrix matrix;
CFX_Matrix ctmOnParent;
CFX_RectF rect;
int32_t count = parents.GetSize();
for (int32_t i = count - 2; i >= 0; i--) {
parent = parents.GetAt(i);
- parent->GetMatrix(ctmOnParent, false);
+
+ if (parent->m_pProperties)
+ ctmOnParent.SetIdentity();
rect = parent->GetWidgetRect();
matrix.Concat(ctmOnParent, true);
matrix.Translate(rect.left, rect.top, true);
@@ -261,6 +258,8 @@ void CFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) {
m.SetIdentity();
matrix.Concat(m, true);
parents.RemoveAll();
+
+ return matrix;
}
IFWL_ThemeProvider* CFWL_Widget::GetThemeProvider() const {