Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: xfa/fwl/cfwl_widget.cpp

Issue 2564443003: Change CFWL_Widget::GetMatrix to return the matrix (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: xfa/fwl/cfwl_widget.cpp
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index 762ab831578225932eae39021a25a50945fbc123..a59a6023a2b96c69baed951b4a6ecc2fc10b9589 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();
dsinclair 2016/12/08 19:02:46 CFX_Matrix constructor calls SetIdentity()
- m1.SetReverse(m);
+ m1.SetReverse(pWidget->GetMatrix());
m1.TransformPoint(fx, fy);
r = pWidget->GetWidgetRect();
fx -= r.left;
@@ -232,27 +230,23 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
}
}
-void CFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) {
- if (!m_pProperties)
- return;
- if (!bGlobal) {
- matrix.SetIdentity();
- return;
- }
-
+CFX_Matrix CFWL_Widget::GetMatrix() {
CFWL_Widget* parent = GetParent();
CFX_ArrayTemplate<CFWL_Widget*> parents;
while (parent) {
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 +255,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 {
« no previous file with comments | « xfa/fwl/cfwl_widget.h ('k') | xfa/fwl/cfwl_widgetmgr.cpp » ('j') | xfa/fwl/cfwl_widgetmgr.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698