summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-21 14:27:59 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-21 20:44:29 +0000
commitb45ea1fce52d93615470bab8b671cba5907fb01e (patch)
tree15153c437a253f73b3f5bb154a294ace77fe2c6d /core
parent37a35df8c878d6e21a62ce0dfd2d480997d9e86c (diff)
downloadpdfium-b45ea1fce52d93615470bab8b671cba5907fb01e.tar.xz
Convert CFWL messages to use CFX_PointF
This Cl updates the various CFWL_Message classes to take CFX_PointF instead of x,y values. Change-Id: I5d9d01d68be64fc9e69c04574994c01286ad24e1 Reviewed-on: https://pdfium-review.googlesource.com/2811 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp7
-rw-r--r--core/fpdfdoc/cpdf_interform.h3
-rw-r--r--core/fpdfdoc/cpdf_linklist.cpp6
-rw-r--r--core/fpdfdoc/cpdf_linklist.h3
-rw-r--r--core/fxcrt/fx_basic_coords.cpp11
-rw-r--r--core/fxcrt/fx_coordinates.h7
6 files changed, 14 insertions, 23 deletions
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index 127e542227..d9f0db9747 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -900,8 +900,8 @@ CPDF_FormField* CPDF_InterForm::GetFieldByDict(
}
CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage,
- FX_FLOAT pdf_x,
- FX_FLOAT pdf_y,
+ const CFX_PointF& point,
+
int* z_order) const {
CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayFor("Annots");
if (!pAnnotList)
@@ -918,8 +918,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage,
continue;
CPDF_FormControl* pControl = it->second.get();
- CFX_FloatRect rect = pControl->GetRect();
- if (!rect.Contains(pdf_x, pdf_y))
+ if (!pControl->GetRect().Contains(point))
continue;
if (z_order)
diff --git a/core/fpdfdoc/cpdf_interform.h b/core/fpdfdoc/cpdf_interform.h
index a42c4cef84..cbaaa7bc2d 100644
--- a/core/fpdfdoc/cpdf_interform.h
+++ b/core/fpdfdoc/cpdf_interform.h
@@ -55,8 +55,7 @@ class CPDF_InterForm {
CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const;
CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage,
- FX_FLOAT pdf_x,
- FX_FLOAT pdf_y,
+ const CFX_PointF& point,
int* z_order) const;
CPDF_FormControl* GetControlByDict(const CPDF_Dictionary* pWidgetDict) const;
diff --git a/core/fpdfdoc/cpdf_linklist.cpp b/core/fpdfdoc/cpdf_linklist.cpp
index 2d8f7e2339..0620dbf32b 100644
--- a/core/fpdfdoc/cpdf_linklist.cpp
+++ b/core/fpdfdoc/cpdf_linklist.cpp
@@ -30,8 +30,7 @@ const std::vector<CPDF_Dictionary*>* CPDF_LinkList::GetPageLinks(
}
CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage,
- FX_FLOAT pdf_x,
- FX_FLOAT pdf_y,
+ const CFX_PointF& point,
int* z_order) {
const std::vector<CPDF_Dictionary*>* pPageLinkList = GetPageLinks(pPage);
if (!pPageLinkList)
@@ -44,8 +43,7 @@ CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage,
continue;
CPDF_Link link(pAnnot);
- CFX_FloatRect rect = link.GetRect();
- if (!rect.Contains(pdf_x, pdf_y))
+ if (!link.GetRect().Contains(point))
continue;
if (z_order)
diff --git a/core/fpdfdoc/cpdf_linklist.h b/core/fpdfdoc/cpdf_linklist.h
index 21d69fdd1d..129790f846 100644
--- a/core/fpdfdoc/cpdf_linklist.h
+++ b/core/fpdfdoc/cpdf_linklist.h
@@ -22,8 +22,7 @@ class CPDF_LinkList {
~CPDF_LinkList();
CPDF_Link GetLinkAtPoint(CPDF_Page* pPage,
- FX_FLOAT pdf_x,
- FX_FLOAT pdf_y,
+ const CFX_PointF& point,
int* z_order);
private:
diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp
index c9f3195f36..3e306339f2 100644
--- a/core/fxcrt/fx_basic_coords.cpp
+++ b/core/fxcrt/fx_basic_coords.cpp
@@ -190,7 +190,10 @@ FX_RECT CFX_FloatRect::GetClosestRect() const {
}
bool CFX_FloatRect::Contains(const CFX_PointF& point) const {
- return Contains(point.x, point.y);
+ CFX_FloatRect n1(*this);
+ n1.Normalize();
+ return point.x <= n1.right && point.x >= n1.left && point.y <= n1.top &&
+ point.y >= n1.bottom;
}
bool CFX_FloatRect::Contains(const CFX_FloatRect& other_rect) const {
@@ -202,12 +205,6 @@ bool CFX_FloatRect::Contains(const CFX_FloatRect& other_rect) const {
n2.top <= n1.top;
}
-bool CFX_FloatRect::Contains(FX_FLOAT x, FX_FLOAT y) const {
- CFX_FloatRect n1(*this);
- n1.Normalize();
- return x <= n1.right && x >= n1.left && y <= n1.top && y >= n1.bottom;
-}
-
void CFX_FloatRect::UpdateRect(FX_FLOAT x, FX_FLOAT y) {
left = std::min(left, x);
right = std::max(right, x);
diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h
index c773d374f1..d1fa8115b7 100644
--- a/core/fxcrt/fx_coordinates.h
+++ b/core/fxcrt/fx_coordinates.h
@@ -361,10 +361,10 @@ class CFX_RTemplate {
return width <= fEpsilon || height <= fEpsilon;
}
void Empty() { width = height = 0; }
- bool Contains(BaseType x, BaseType y) const {
- return x >= left && x < left + width && y >= top && y < top + height;
+ bool Contains(const PointType& p) const {
+ return p.x >= left && p.x < left + width && p.y >= top &&
+ p.y < top + height;
}
- bool Contains(const PointType& p) const { return Contains(p.x, p.y); }
bool Contains(const RectType& rt) const {
return rt.left >= left && rt.right() <= right() && rt.top >= top &&
rt.bottom() <= bottom();
@@ -474,7 +474,6 @@ class CFX_FloatRect {
bool Contains(const CFX_PointF& point) const;
bool Contains(const CFX_FloatRect& other_rect) const;
- bool Contains(FX_FLOAT x, FX_FLOAT y) const;
void Intersect(const CFX_FloatRect& other_rect);
void Union(const CFX_FloatRect& other_rect);