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

Unified Diff: xfa/fwl/cfwl_widget.cpp

Issue 2564443003: Change CFWL_Widget::GetMatrix to return the matrix (Closed)
Patch Set: Re-add check 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..8e27516dbba63621628ab9973851b96278a8abaa 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) {
Tom Sepez 2016/12/08 19:23:07 really? really? sigh.
- 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 {
« xfa/fwl/cfwl_widget.h ('K') | « xfa/fwl/cfwl_widget.h ('k') | xfa/fwl/cfwl_widgetmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698