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/include/fpdfapi/fpdf_pageobj.h" | 7 #include "core/include/fpdfapi/fpdf_pageobj.h" |
8 #include "core/include/fpdfdoc/fpdf_doc.h" | 8 #include "core/include/fpdfdoc/fpdf_doc.h" |
9 | 9 |
10 CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) | 10 CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 continue; | 70 continue; |
71 | 71 |
72 if (pOptions) { | 72 if (pOptions) { |
73 IPDF_OCContext* pOCContext = pOptions->m_pOCContext; | 73 IPDF_OCContext* pOCContext = pOptions->m_pOCContext; |
74 CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict(); | 74 CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict(); |
75 if (pOCContext && pAnnotDict && | 75 if (pOCContext && pAnnotDict && |
76 !pOCContext->CheckOCGVisible(pAnnotDict->GetDictBy("OC"))) { | 76 !pOCContext->CheckOCGVisible(pAnnotDict->GetDictBy("OC"))) { |
77 continue; | 77 continue; |
78 } | 78 } |
79 } | 79 } |
80 CPDF_Rect annot_rect_f; | 80 CFX_FloatRect annot_rect_f; |
81 pAnnot->GetRect(annot_rect_f); | 81 pAnnot->GetRect(annot_rect_f); |
82 CFX_Matrix matrix = *pMatrix; | 82 CFX_Matrix matrix = *pMatrix; |
83 if (clip_rect) { | 83 if (clip_rect) { |
84 annot_rect_f.Transform(&matrix); | 84 annot_rect_f.Transform(&matrix); |
85 FX_RECT annot_rect = annot_rect_f.GetOutterRect(); | 85 FX_RECT annot_rect = annot_rect_f.GetOutterRect(); |
86 annot_rect.Intersect(*clip_rect); | 86 annot_rect.Intersect(*clip_rect); |
87 if (annot_rect.IsEmpty()) { | 87 if (annot_rect.IsEmpty()) { |
88 continue; | 88 continue; |
89 } | 89 } |
90 } | 90 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void CPDF_Annot::ClearCachedAP() { | 125 void CPDF_Annot::ClearCachedAP() { |
126 for (const auto& pair : m_APMap) { | 126 for (const auto& pair : m_APMap) { |
127 delete pair.second; | 127 delete pair.second; |
128 } | 128 } |
129 m_APMap.clear(); | 129 m_APMap.clear(); |
130 } | 130 } |
131 CFX_ByteString CPDF_Annot::GetSubType() const { | 131 CFX_ByteString CPDF_Annot::GetSubType() const { |
132 return m_sSubtype; | 132 return m_sSubtype; |
133 } | 133 } |
134 | 134 |
135 void CPDF_Annot::GetRect(CPDF_Rect& rect) const { | 135 void CPDF_Annot::GetRect(CFX_FloatRect& rect) const { |
136 if (!m_pAnnotDict) { | 136 if (!m_pAnnotDict) { |
137 return; | 137 return; |
138 } | 138 } |
139 rect = m_pAnnotDict->GetRectBy("Rect"); | 139 rect = m_pAnnotDict->GetRectBy("Rect"); |
140 rect.Normalize(); | 140 rect.Normalize(); |
141 } | 141 } |
142 | 142 |
143 FX_DWORD CPDF_Annot::GetFlags() const { | 143 FX_DWORD CPDF_Annot::GetFlags() const { |
144 return m_pAnnotDict->GetIntegerBy("F"); | 144 return m_pAnnotDict->GetIntegerBy("F"); |
145 } | 145 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 CPDF_Annot::AppearanceMode mode, | 203 CPDF_Annot::AppearanceMode mode, |
204 const CFX_Matrix* pUser2Device, | 204 const CFX_Matrix* pUser2Device, |
205 CFX_Matrix& matrix) { | 205 CFX_Matrix& matrix) { |
206 CPDF_Form* pForm = pAnnot->GetAPForm(pPage, mode); | 206 CPDF_Form* pForm = pAnnot->GetAPForm(pPage, mode); |
207 if (!pForm) { | 207 if (!pForm) { |
208 return NULL; | 208 return NULL; |
209 } | 209 } |
210 CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectBy("BBox"); | 210 CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectBy("BBox"); |
211 CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix"); | 211 CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix"); |
212 form_matrix.TransformRect(form_bbox); | 212 form_matrix.TransformRect(form_bbox); |
213 CPDF_Rect arect; | 213 CFX_FloatRect arect; |
214 pAnnot->GetRect(arect); | 214 pAnnot->GetRect(arect); |
215 matrix.MatchRect(arect, form_bbox); | 215 matrix.MatchRect(arect, form_bbox); |
216 matrix.Concat(*pUser2Device); | 216 matrix.Concat(*pUser2Device); |
217 return pForm; | 217 return pForm; |
218 } | 218 } |
219 FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage, | 219 FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage, |
220 CFX_RenderDevice* pDevice, | 220 CFX_RenderDevice* pDevice, |
221 const CFX_Matrix* pUser2Device, | 221 const CFX_Matrix* pUser2Device, |
222 AppearanceMode mode, | 222 AppearanceMode mode, |
223 const CPDF_RenderOptions* pOptions) { | 223 const CPDF_RenderOptions* pOptions) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 CFX_PathData path; | 338 CFX_PathData path; |
339 width /= 2; | 339 width /= 2; |
340 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, | 340 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, |
341 rect.top - width); | 341 rect.top - width); |
342 int fill_type = 0; | 342 int fill_type = 0; |
343 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { | 343 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { |
344 fill_type |= FXFILL_NOPATHSMOOTH; | 344 fill_type |= FXFILL_NOPATHSMOOTH; |
345 } | 345 } |
346 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); | 346 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); |
347 } | 347 } |
OLD | NEW |