summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-21 12:56:24 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-21 19:05:18 +0000
commit1f403cee9478021862c7cc4e516907bd51e8f0f6 (patch)
tree57829fa3b036ee9ddd57a8ad5b3541fe4e96fdb8 /xfa/fxfa
parent04557b8a7c2d3dab06fe9eadacc3c7744b3e14e2 (diff)
downloadpdfium-1f403cee9478021862c7cc4e516907bd51e8f0f6.tar.xz
Convert more TransformPoint calls to Transform
This Cl converts several uses of TransformPoint to use Transform(CFX_PointF). Change-Id: I9bc3c484e0a4304b904584218bd9e59dec7db727 Reviewed-on: https://pdfium-review.googlesource.com/2791 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp12
-rw-r--r--xfa/fxfa/app/xfa_ffwidgethandler.cpp40
-rw-r--r--xfa/fxfa/xfa_ffwidget.h2
3 files changed, 28 insertions, 26 deletions
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index 3ee0a3cbe8..7a8cc646dd 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -316,15 +316,17 @@ bool CXFA_FFWidget::ReplaceSpellCheckWord(CFX_PointF pointf,
const CFX_ByteStringC& bsReplace) {
return false;
}
-void CXFA_FFWidget::Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy) {
+
+CFX_PointF CXFA_FFWidget::Rotate2Normal(const CFX_PointF& point) {
CFX_Matrix mt = GetRotateMatrix();
- if (mt.IsIdentity()) {
- return;
- }
+ if (mt.IsIdentity())
+ return point;
+
CFX_Matrix mtReverse;
mtReverse.SetReverse(mt);
- mtReverse.TransformPoint(fx, fy);
+ return mtReverse.Transform(point);
}
+
static void XFA_GetMatrix(CFX_Matrix& m,
int32_t iRotate,
XFA_ATTRIBUTEENUM at,
diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp
index 551d8f6595..bbca0409d3 100644
--- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp
@@ -43,8 +43,8 @@ bool CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget,
FX_FLOAT fx,
FX_FLOAT fy) {
m_pDocView->LockUpdate();
- hWidget->Rotate2Normal(fx, fy);
- bool bRet = hWidget->OnLButtonDown(dwFlags, fx, fy);
+ CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
+ bool bRet = hWidget->OnLButtonDown(dwFlags, pos.x, pos.y);
if (bRet && m_pDocView->SetFocus(hWidget)) {
m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget(
m_pDocView->GetDoc(), hWidget);
@@ -59,9 +59,9 @@ bool CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget,
FX_FLOAT fx,
FX_FLOAT fy) {
m_pDocView->LockUpdate();
- hWidget->Rotate2Normal(fx, fy);
+ CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
m_pDocView->m_bLayoutEvent = true;
- bool bRet = hWidget->OnLButtonUp(dwFlags, fx, fy);
+ bool bRet = hWidget->OnLButtonUp(dwFlags, pos.x, pos.y);
m_pDocView->UnlockUpdate();
m_pDocView->UpdateDocView();
return bRet;
@@ -71,8 +71,8 @@ bool CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
FX_FLOAT fx,
FX_FLOAT fy) {
- hWidget->Rotate2Normal(fx, fy);
- bool bRet = hWidget->OnLButtonDblClk(dwFlags, fx, fy);
+ CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
+ bool bRet = hWidget->OnLButtonDblClk(dwFlags, pos.x, pos.y);
m_pDocView->RunInvalidate();
return bRet;
}
@@ -81,8 +81,8 @@ bool CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
FX_FLOAT fx,
FX_FLOAT fy) {
- hWidget->Rotate2Normal(fx, fy);
- bool bRet = hWidget->OnMouseMove(dwFlags, fx, fy);
+ CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
+ bool bRet = hWidget->OnMouseMove(dwFlags, pos.x, pos.y);
m_pDocView->RunInvalidate();
return bRet;
}
@@ -92,8 +92,8 @@ bool CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget,
int16_t zDelta,
FX_FLOAT fx,
FX_FLOAT fy) {
- hWidget->Rotate2Normal(fx, fy);
- bool bRet = hWidget->OnMouseWheel(dwFlags, zDelta, fx, fy);
+ CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
+ bool bRet = hWidget->OnMouseWheel(dwFlags, zDelta, pos.x, pos.y);
m_pDocView->RunInvalidate();
return bRet;
}
@@ -102,8 +102,8 @@ bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
FX_FLOAT fx,
FX_FLOAT fy) {
- hWidget->Rotate2Normal(fx, fy);
- bool bRet = hWidget->OnRButtonDown(dwFlags, fx, fy);
+ CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
+ bool bRet = hWidget->OnRButtonDown(dwFlags, pos.x, pos.y);
if (bRet && m_pDocView->SetFocus(hWidget)) {
m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget(
m_pDocView->GetDoc(), hWidget);
@@ -116,8 +116,8 @@ bool CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
FX_FLOAT fx,
FX_FLOAT fy) {
- hWidget->Rotate2Normal(fx, fy);
- bool bRet = hWidget->OnRButtonUp(dwFlags, fx, fy);
+ CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
+ bool bRet = hWidget->OnRButtonUp(dwFlags, pos.x, pos.y);
m_pDocView->RunInvalidate();
return bRet;
}
@@ -126,8 +126,8 @@ bool CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget,
uint32_t dwFlags,
FX_FLOAT fx,
FX_FLOAT fy) {
- hWidget->Rotate2Normal(fx, fy);
- bool bRet = hWidget->OnRButtonDblClk(dwFlags, fx, fy);
+ CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
+ bool bRet = hWidget->OnRButtonDblClk(dwFlags, pos.x, pos.y);
m_pDocView->RunInvalidate();
return bRet;
}
@@ -163,15 +163,15 @@ FWL_WidgetHit CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget,
if (!(hWidget->GetStatus() & XFA_WidgetStatus_Visible))
return FWL_WidgetHit::Unknown;
- hWidget->Rotate2Normal(fx, fy);
- return hWidget->OnHitTest(fx, fy);
+ CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
+ return hWidget->OnHitTest(pos.x, pos.y);
}
bool CXFA_FFWidgetHandler::OnSetCursor(CXFA_FFWidget* hWidget,
FX_FLOAT fx,
FX_FLOAT fy) {
- hWidget->Rotate2Normal(fx, fy);
- return hWidget->OnSetCursor(fx, fy);
+ CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy));
+ return hWidget->OnSetCursor(pos.x, pos.y);
}
void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget,
diff --git a/xfa/fxfa/xfa_ffwidget.h b/xfa/fxfa/xfa_ffwidget.h
index c7701d357e..57dfc639da 100644
--- a/xfa/fxfa/xfa_ffwidget.h
+++ b/xfa/fxfa/xfa_ffwidget.h
@@ -119,7 +119,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem {
void AddInvalidateRect(const CFX_RectF* pRect = nullptr);
bool GetCaptionText(CFX_WideString& wsCap);
bool IsFocused();
- void Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy);
+ CFX_PointF Rotate2Normal(const CFX_PointF& point);
CFX_Matrix GetRotateMatrix();
bool IsLayoutRectEmpty();
CXFA_FFWidget* GetParent();