summaryrefslogtreecommitdiff
path: root/core/fpdftext
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdftext')
-rw-r--r--core/fpdftext/cpdf_textpage.cpp21
-rw-r--r--core/fpdftext/cpdf_textpage.h8
2 files changed, 7 insertions, 22 deletions
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index b5563bb0c5..bd60435bb1 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -301,8 +301,7 @@ std::vector<CFX_FloatRect> CPDF_TextPage::GetRectArray(int start,
}
int CPDF_TextPage::GetIndexAtPos(const CFX_PointF& point,
- FX_FLOAT xTolerance,
- FX_FLOAT yTolerance) const {
+ const CFX_SizeF& tolerance) const {
if (!m_bIsParsed)
return -3;
@@ -315,13 +314,13 @@ int CPDF_TextPage::GetIndexAtPos(const CFX_PointF& point,
CFX_FloatRect charrect = charinfo.m_CharBox;
if (charrect.Contains(point))
break;
- if (xTolerance > 0 || yTolerance > 0) {
+ if (tolerance.width > 0 || tolerance.height > 0) {
CFX_FloatRect charRectExt;
charrect.Normalize();
- charRectExt.left = charrect.left - xTolerance / 2;
- charRectExt.right = charrect.right + xTolerance / 2;
- charRectExt.top = charrect.top + yTolerance / 2;
- charRectExt.bottom = charrect.bottom - yTolerance / 2;
+ charRectExt.left = charrect.left - tolerance.width / 2;
+ charRectExt.right = charrect.right + tolerance.width / 2;
+ charRectExt.top = charrect.top + tolerance.height / 2;
+ charRectExt.bottom = charrect.bottom - tolerance.height / 2;
if (charRectExt.Contains(point)) {
double curXdif, curYdif;
curXdif = FXSYS_fabs(point.x - charrect.left) <
@@ -378,14 +377,6 @@ CFX_WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const {
return strText;
}
-int CPDF_TextPage::GetIndexAtPos(FX_FLOAT x,
- FX_FLOAT y,
- FX_FLOAT xTolerance,
- FX_FLOAT yTolerance) const {
- CFX_PointF point(x, y);
- return GetIndexAtPos(point, xTolerance, yTolerance);
-}
-
void CPDF_TextPage::GetCharInfo(int index, FPDF_CHAR_INFO* info) const {
if (!m_bIsParsed)
return;
diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
index 787715fc51..91942d1bec 100644
--- a/core/fpdftext/cpdf_textpage.h
+++ b/core/fpdftext/cpdf_textpage.h
@@ -98,13 +98,7 @@ class CPDF_TextPage {
int CountChars() const;
void GetCharInfo(int index, FPDF_CHAR_INFO* info) const;
std::vector<CFX_FloatRect> GetRectArray(int start, int nCount) const;
- int GetIndexAtPos(const CFX_PointF& point,
- FX_FLOAT xTolerance,
- FX_FLOAT yTolerance) const;
- int GetIndexAtPos(FX_FLOAT x,
- FX_FLOAT y,
- FX_FLOAT xTolerance,
- FX_FLOAT yTolerance) const;
+ int GetIndexAtPos(const CFX_PointF& point, const CFX_SizeF& tolerance) const;
CFX_WideString GetTextByRect(const CFX_FloatRect& rect) const;
CFX_WideString GetPageText(int start = 0, int nCount = -1) const;
int CountRects(int start, int nCount);