OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/src/fpdftext/text_int.h" | 7 #include "core/src/fpdftext/text_int.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cctype> | 10 #include <cctype> |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 rect.top = info_curchar.m_CharBox.top; | 294 rect.top = info_curchar.m_CharBox.top; |
295 } | 295 } |
296 if (rect.bottom > info_curchar.m_CharBox.bottom) { | 296 if (rect.bottom > info_curchar.m_CharBox.bottom) { |
297 rect.bottom = info_curchar.m_CharBox.bottom; | 297 rect.bottom = info_curchar.m_CharBox.bottom; |
298 } | 298 } |
299 } | 299 } |
300 } | 300 } |
301 rectArray.Add(rect); | 301 rectArray.Add(rect); |
302 } | 302 } |
303 | 303 |
304 int CPDF_TextPage::GetIndexAtPos(CPDF_Point point, | 304 int CPDF_TextPage::GetIndexAtPos(CFX_FloatPoint point, |
305 FX_FLOAT xTolerance, | 305 FX_FLOAT xTolerance, |
306 FX_FLOAT yTolerance) const { | 306 FX_FLOAT yTolerance) const { |
307 if (!m_bIsParsed) | 307 if (!m_bIsParsed) |
308 return -3; | 308 return -3; |
309 | 309 |
310 int pos = 0; | 310 int pos = 0; |
311 int NearPos = -1; | 311 int NearPos = -1; |
312 double xdif = 5000; | 312 double xdif = 5000; |
313 double ydif = 5000; | 313 double ydif = 5000; |
314 while (pos < pdfium::CollectionSize<int>(m_CharList)) { | 314 while (pos < pdfium::CollectionSize<int>(m_CharList)) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 curRect.top = std::max(curRect.top, info_curchar.m_CharBox.top); | 417 curRect.top = std::max(curRect.top, info_curchar.m_CharBox.top); |
418 } | 418 } |
419 } | 419 } |
420 resRectArray.Add(curRect); | 420 resRectArray.Add(curRect); |
421 } | 421 } |
422 | 422 |
423 int CPDF_TextPage::GetIndexAtPos(FX_FLOAT x, | 423 int CPDF_TextPage::GetIndexAtPos(FX_FLOAT x, |
424 FX_FLOAT y, | 424 FX_FLOAT y, |
425 FX_FLOAT xTolerance, | 425 FX_FLOAT xTolerance, |
426 FX_FLOAT yTolerance) const { | 426 FX_FLOAT yTolerance) const { |
427 CPDF_Point point(x, y); | 427 CFX_FloatPoint point(x, y); |
428 return GetIndexAtPos(point, xTolerance, yTolerance); | 428 return GetIndexAtPos(point, xTolerance, yTolerance); |
429 } | 429 } |
430 | 430 |
431 void CPDF_TextPage::GetCharInfo(int index, FPDF_CHAR_INFO* info) const { | 431 void CPDF_TextPage::GetCharInfo(int index, FPDF_CHAR_INFO* info) const { |
432 if (!m_bIsParsed) | 432 if (!m_bIsParsed) |
433 return; | 433 return; |
434 | 434 |
435 if (index < 0 || index >= pdfium::CollectionSize<int>(m_CharList)) | 435 if (index < 0 || index >= pdfium::CollectionSize<int>(m_CharList)) |
436 return; | 436 return; |
437 | 437 |
(...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2493 if (!m_bIsParsed || index < 0 || index >= m_LinkList.GetSize()) { | 2493 if (!m_bIsParsed || index < 0 || index >= m_LinkList.GetSize()) { |
2494 return; | 2494 return; |
2495 } | 2495 } |
2496 CPDF_LinkExt* link = NULL; | 2496 CPDF_LinkExt* link = NULL; |
2497 link = m_LinkList.GetAt(index); | 2497 link = m_LinkList.GetAt(index); |
2498 if (!link) { | 2498 if (!link) { |
2499 return; | 2499 return; |
2500 } | 2500 } |
2501 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); | 2501 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); |
2502 } | 2502 } |
OLD | NEW |