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 "../../include/fpdfdoc/fpdf_doc.h" | 7 #include "../../include/fpdfdoc/fpdf_doc.h" |
8 #include "../../src/fxcrt/fx_safe_types.h" | 8 #include "../../src/fxcrt/fx_safe_types.h" |
9 | 9 |
10 CPDF_LinkList::~CPDF_LinkList() | 10 CPDF_LinkList::~CPDF_LinkList() |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 return (CPDF_Dictionary*)pPageLinkList->GetAt(index); | 50 return (CPDF_Dictionary*)pPageLinkList->GetAt(index); |
51 } | 51 } |
52 CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLO
AT pdf_y) | 52 CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLO
AT pdf_y) |
53 { | 53 { |
54 CFX_PtrArray* pPageLinkList = GetPageLinks(pPage); | 54 CFX_PtrArray* pPageLinkList = GetPageLinks(pPage); |
55 if (pPageLinkList == NULL) { | 55 if (pPageLinkList == NULL) { |
56 return NULL; | 56 return NULL; |
57 } | 57 } |
58 int size = pPageLinkList->GetSize(); | 58 int size = pPageLinkList->GetSize(); |
59 for (int i = 0; i < size; i ++) { | 59 for (int i = size - 1; i >= 0; --i) { |
60 CPDF_Link Link = (CPDF_Dictionary*)pPageLinkList->GetAt(i); | 60 CPDF_Link Link = (CPDF_Dictionary*)pPageLinkList->GetAt(i); |
61 CPDF_Rect rect = Link.GetRect(); | 61 CPDF_Rect rect = Link.GetRect(); |
62 if (rect.Contains(pdf_x, pdf_y)) { | 62 if (rect.Contains(pdf_x, pdf_y)) { |
63 return Link; | 63 return Link; |
64 } | 64 } |
65 } | 65 } |
66 return NULL; | 66 return NULL; |
67 } | 67 } |
68 void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage, CFX_PtrArray* pList) | 68 void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage, CFX_PtrArray* pList) |
69 { | 69 { |
(...skipping 28 matching lines...) Expand all Loading... |
98 return name_tree.LookupNamedDest(pDoc, name); | 98 return name_tree.LookupNamedDest(pDoc, name); |
99 } else if (pDest->GetType() == PDFOBJ_ARRAY) { | 99 } else if (pDest->GetType() == PDFOBJ_ARRAY) { |
100 return (CPDF_Array*)pDest; | 100 return (CPDF_Array*)pDest; |
101 } | 101 } |
102 return NULL; | 102 return NULL; |
103 } | 103 } |
104 CPDF_Action CPDF_Link::GetAction() | 104 CPDF_Action CPDF_Link::GetAction() |
105 { | 105 { |
106 return m_pDict->GetDict("A"); | 106 return m_pDict->GetDict("A"); |
107 } | 107 } |
OLD | NEW |