summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-09 13:07:43 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-09 19:02:55 +0000
commitafb44560a21298b3588b36cbaf45e2be50f2e75b (patch)
tree21f3ececad017e6be64a19c4370cfe9fd7f9c29c /fpdfsdk
parent67e4faaf8be0aebc67ebfb96d33933d9f9119d20 (diff)
downloadpdfium-afb44560a21298b3588b36cbaf45e2be50f2e75b.tar.xz
Remove Transform in favour of TransformPoint
This CL removes the two Transform() overrides from CFX_Matrix and calls the TransformPoint methods directly. In the case of the 4 param version the values were assigned to the out values before calling. Change-Id: Id633826caec75b848774dcda6cfdcef2dbf5a7db Reviewed-on: https://pdfium-review.googlesource.com/2573 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cfx_systemhandler.cpp15
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp20
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp6
-rw-r--r--fpdfsdk/fpdfview.cpp16
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.cpp17
-rw-r--r--fpdfsdk/fxedit/fxet_edit.cpp10
-rw-r--r--fpdfsdk/pdfwindow/PWL_EditCtrl.cpp4
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.cpp6
8 files changed, 42 insertions, 52 deletions
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index f38be4c3e8..b897a3e0bb 100644
--- a/fpdfsdk/cfx_systemhandler.cpp
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -46,14 +46,13 @@ void CFX_SystemHandler::InvalidateRect(CPDFSDK_Widget* widget, FX_RECT rect) {
CFX_Matrix device2page;
device2page.SetReverse(page2device);
- FX_FLOAT left;
- FX_FLOAT top;
- FX_FLOAT right;
- FX_FLOAT bottom;
- device2page.Transform(static_cast<FX_FLOAT>(rect.left),
- static_cast<FX_FLOAT>(rect.top), left, top);
- device2page.Transform(static_cast<FX_FLOAT>(rect.right),
- static_cast<FX_FLOAT>(rect.bottom), right, bottom);
+ FX_FLOAT left = static_cast<FX_FLOAT>(rect.left);
+ FX_FLOAT top = static_cast<FX_FLOAT>(rect.top);
+ FX_FLOAT right = static_cast<FX_FLOAT>(rect.right);
+ FX_FLOAT bottom = static_cast<FX_FLOAT>(rect.bottom);
+ device2page.TransformPoint(left, top);
+ device2page.TransformPoint(right, bottom);
+
CFX_FloatRect rcPDF(left, bottom, right, top);
rcPDF.Normalize();
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 108690665c..1af4703da0 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -841,24 +841,18 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice,
if (!m_pInterForm->IsNeedHighLight(nFieldType))
return;
- CFX_FloatRect rc = GetRect();
- FX_COLORREF color = m_pInterForm->GetHighlightColor(nFieldType);
- uint8_t alpha = m_pInterForm->GetHighlightAlpha();
-
- CFX_FloatRect rcDevice;
CFX_Matrix page2device;
pPageView->GetCurrentMatrix(page2device);
- page2device.Transform(((FX_FLOAT)rc.left), ((FX_FLOAT)rc.bottom),
- rcDevice.left, rcDevice.bottom);
- page2device.Transform(((FX_FLOAT)rc.right), ((FX_FLOAT)rc.top),
- rcDevice.right, rcDevice.top);
+ CFX_FloatRect rcDevice = GetRect();
+ page2device.TransformPoint(rcDevice.left, rcDevice.bottom);
+ page2device.TransformPoint(rcDevice.right, rcDevice.top);
rcDevice.Normalize();
- FX_ARGB argb = ArgbEncode((int)alpha, color);
- FX_RECT rcDev((int)rcDevice.left, (int)rcDevice.top, (int)rcDevice.right,
- (int)rcDevice.bottom);
- pDevice->FillRect(&rcDev, argb);
+ FX_RECT rcDev = rcDevice.ToFxRect();
+ pDevice->FillRect(
+ &rcDev, ArgbEncode(static_cast<int>(m_pInterForm->GetHighlightAlpha()),
+ m_pInterForm->GetHighlightColor(nFieldType)));
}
void CPDFSDK_Widget::ResetAppearance_PushButton() {
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 71feb54bef..9ccca2b04a 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -488,8 +488,7 @@ CFX_FloatPoint CFFL_FormFiller::FFLtoPWL(const CFX_FloatPoint& point) {
mt.SetReverse(GetCurMatrix());
CFX_FloatPoint pt = point;
- mt.Transform(pt.x, pt.y);
-
+ mt.TransformPoint(pt.x, pt.y);
return pt;
}
@@ -497,8 +496,7 @@ CFX_FloatPoint CFFL_FormFiller::PWLtoFFL(const CFX_FloatPoint& point) {
CFX_Matrix mt = GetCurMatrix();
CFX_FloatPoint pt = point;
- mt.Transform(pt.x, pt.y);
-
+ mt.TransformPoint(pt.x, pt.y);
return pt;
}
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 2c2f25ab0b..57d5d4d343 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -855,10 +855,10 @@ DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page,
CFX_Matrix device2page;
device2page.SetReverse(page2device);
- FX_FLOAT page_x_f;
- FX_FLOAT page_y_f;
- device2page.Transform(static_cast<FX_FLOAT>(device_x),
- static_cast<FX_FLOAT>(device_y), page_x_f, page_y_f);
+ FX_FLOAT page_x_f = static_cast<FX_FLOAT>(device_x);
+ FX_FLOAT page_y_f = static_cast<FX_FLOAT>(device_y);
+ device2page.TransformPoint(page_x_f, page_y_f);
+
*page_x = page_x_f;
*page_y = page_y_f;
#endif // PDF_ENABLE_XFA
@@ -885,10 +885,10 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page,
#else // PDF_ENABLE_XFA
CFX_Matrix page2device =
pPage->GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
- FX_FLOAT device_x_f;
- FX_FLOAT device_y_f;
- page2device.Transform(static_cast<FX_FLOAT>(page_x),
- static_cast<FX_FLOAT>(page_y), device_x_f, device_y_f);
+ FX_FLOAT device_x_f = static_cast<FX_FLOAT>(page_x);
+ FX_FLOAT device_y_f = static_cast<FX_FLOAT>(page_y);
+ page2device.TransformPoint(device_x_f, device_y_f);
+
*device_x = FXSYS_round(device_x_f);
*device_y = FXSYS_round(device_y_f);
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index f39a01078e..b708a361e5 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -154,13 +154,13 @@ void CPDFXFA_Page::DeviceToPage(int start_x,
if (!m_pPDFPage && !m_pXFAPageView)
return;
- FX_FLOAT page_x_f, page_y_f;
-
CFX_Matrix device2page;
device2page.SetReverse(
GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate));
- device2page.Transform(static_cast<FX_FLOAT>(device_x),
- static_cast<FX_FLOAT>(device_y), page_x_f, page_y_f);
+
+ FX_FLOAT page_x_f = static_cast<FX_FLOAT>(device_x);
+ FX_FLOAT page_y_f = static_cast<FX_FLOAT>(device_y);
+ device2page.TransformPoint(page_x_f, page_y_f);
*page_x = page_x_f;
*page_y = page_y_f;
@@ -178,13 +178,12 @@ void CPDFXFA_Page::PageToDevice(int start_x,
if (!m_pPDFPage && !m_pXFAPageView)
return;
- FX_FLOAT device_x_f;
- FX_FLOAT device_y_f;
-
CFX_Matrix page2device =
GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
- page2device.Transform(static_cast<FX_FLOAT>(page_x),
- static_cast<FX_FLOAT>(page_y), device_x_f, device_y_f);
+
+ FX_FLOAT device_x_f = static_cast<FX_FLOAT>(page_x);
+ FX_FLOAT device_y_f = static_cast<FX_FLOAT>(page_y);
+ page2device.TransformPoint(device_x_f, device_y_f);
*device_x = FXSYS_round(device_x_f);
*device_y = FXSYS_round(device_y_f);
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index 690f042afb..1942232553 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -66,7 +66,7 @@ void DrawTextString(CFX_RenderDevice* pDevice,
FX_ARGB crTextStroke,
int32_t nHorzScale) {
FX_FLOAT x = pt.x, y = pt.y;
- pUser2Device->Transform(x, y);
+ pUser2Device->TransformPoint(x, y);
if (pFont) {
if (nHorzScale != 100) {
@@ -80,8 +80,8 @@ void DrawTextString(CFX_RenderDevice* pDevice,
if (crTextStroke != 0) {
CFX_FloatPoint pt1;
CFX_FloatPoint pt2;
- pUser2Device->Transform(pt1.x, pt1.y);
- pUser2Device->Transform(pt2.x, pt2.y);
+ pUser2Device->TransformPoint(pt1.x, pt1.y);
+ pUser2Device->TransformPoint(pt2.x, pt2.y);
CFX_GraphStateData gsd;
gsd.m_LineWidth =
(FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y));
@@ -101,8 +101,8 @@ void DrawTextString(CFX_RenderDevice* pDevice,
if (crTextStroke != 0) {
CFX_FloatPoint pt1;
CFX_FloatPoint pt2;
- pUser2Device->Transform(pt1.x, pt1.y);
- pUser2Device->Transform(pt2.x, pt2.y);
+ pUser2Device->TransformPoint(pt1.x, pt1.y);
+ pUser2Device->TransformPoint(pt2.x, pt2.y);
CFX_GraphStateData gsd;
gsd.m_LineWidth =
(FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y));
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
index 94592159d4..90b7a3c7c0 100644
--- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
@@ -43,8 +43,8 @@ bool CPWL_EditCtrl::IsWndHorV() {
CFX_FloatPoint point1(0, 1);
CFX_FloatPoint point2(1, 1);
- mt.Transform(point1.x, point1.y);
- mt.Transform(point2.x, point2.y);
+ mt.TransformPoint(point1.x, point1.y);
+ mt.TransformPoint(point2.x, point2.y);
return point2.y == point1.y;
}
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
index 8fd7b16212..1170660f1c 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
@@ -855,7 +855,7 @@ void CPWL_Wnd::PWLtoWnd(const CFX_FloatPoint& point,
int32_t& y) const {
CFX_Matrix mt = GetWindowMatrix();
CFX_FloatPoint pt = point;
- mt.Transform(pt.x, pt.y);
+ mt.TransformPoint(pt.x, pt.y);
x = (int32_t)(pt.x + 0.5);
y = (int32_t)(pt.y + 0.5);
}
@@ -874,7 +874,7 @@ CFX_FloatPoint CPWL_Wnd::ChildToParent(const CFX_FloatPoint& point) const {
return point;
CFX_FloatPoint pt = point;
- mt.Transform(pt.x, pt.y);
+ mt.TransformPoint(pt.x, pt.y);
return pt;
}
@@ -895,7 +895,7 @@ CFX_FloatPoint CPWL_Wnd::ParentToChild(const CFX_FloatPoint& point) const {
mt.SetReverse(mt);
CFX_FloatPoint pt = point;
- mt.Transform(pt.x, pt.y);
+ mt.TransformPoint(pt.x, pt.y);
return pt;
}