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/fpdfapi/fpdf_page/include/cpdf_form.h" | 7 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" |
8 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 8 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayBy("Annots"); | 23 CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayBy("Annots"); |
24 if (!pAnnots) | 24 if (!pAnnots) |
25 return; | 25 return; |
26 | 26 |
27 CPDF_Dictionary* pRoot = m_pDocument->GetRoot(); | 27 CPDF_Dictionary* pRoot = m_pDocument->GetRoot(); |
28 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); | 28 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); |
29 FX_BOOL bRegenerateAP = | 29 FX_BOOL bRegenerateAP = |
30 pAcroForm && pAcroForm->GetBooleanBy("NeedAppearances"); | 30 pAcroForm && pAcroForm->GetBooleanBy("NeedAppearances"); |
31 for (uint32_t i = 0; i < pAnnots->GetCount(); ++i) { | 31 for (uint32_t i = 0; i < pAnnots->GetCount(); ++i) { |
32 CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetElementValue(i)); | 32 CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetDirectObjectAt(i)); |
33 if (!pDict) | 33 if (!pDict) |
34 continue; | 34 continue; |
35 | 35 |
36 uint32_t dwObjNum = pDict->GetObjNum(); | 36 uint32_t dwObjNum = pDict->GetObjNum(); |
37 if (dwObjNum == 0) { | 37 if (dwObjNum == 0) { |
38 dwObjNum = m_pDocument->AddIndirectObject(pDict); | 38 dwObjNum = m_pDocument->AddIndirectObject(pDict); |
39 CPDF_Reference* pAction = new CPDF_Reference(m_pDocument, dwObjNum); | 39 CPDF_Reference* pAction = new CPDF_Reference(m_pDocument, dwObjNum); |
40 pAnnots->InsertAt(i, pAction); | 40 pAnnots->InsertAt(i, pAction); |
41 pAnnots->RemoveAt(i + 1); | 41 pAnnots->RemoveAt(i + 1); |
42 pDict = pAnnots->GetDictAt(i); | 42 pDict = pAnnots->GetDictAt(i); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 return NULL; | 159 return NULL; |
160 } | 160 } |
161 const FX_CHAR* ap_entry = "N"; | 161 const FX_CHAR* ap_entry = "N"; |
162 if (mode == CPDF_Annot::Down) | 162 if (mode == CPDF_Annot::Down) |
163 ap_entry = "D"; | 163 ap_entry = "D"; |
164 else if (mode == CPDF_Annot::Rollover) | 164 else if (mode == CPDF_Annot::Rollover) |
165 ap_entry = "R"; | 165 ap_entry = "R"; |
166 if (!pAP->KeyExist(ap_entry)) | 166 if (!pAP->KeyExist(ap_entry)) |
167 ap_entry = "N"; | 167 ap_entry = "N"; |
168 | 168 |
169 CPDF_Object* psub = pAP->GetElementValue(ap_entry); | 169 CPDF_Object* psub = pAP->GetDirectObjectBy(ap_entry); |
170 if (!psub) | 170 if (!psub) |
171 return nullptr; | 171 return nullptr; |
172 if (CPDF_Stream* pStream = psub->AsStream()) | 172 if (CPDF_Stream* pStream = psub->AsStream()) |
173 return pStream; | 173 return pStream; |
174 | 174 |
175 if (CPDF_Dictionary* pDict = psub->AsDictionary()) { | 175 if (CPDF_Dictionary* pDict = psub->AsDictionary()) { |
176 CFX_ByteString as = pAnnotDict->GetStringBy("AS"); | 176 CFX_ByteString as = pAnnotDict->GetStringBy("AS"); |
177 if (as.IsEmpty()) { | 177 if (as.IsEmpty()) { |
178 CFX_ByteString value = pAnnotDict->GetStringBy("V"); | 178 CFX_ByteString value = pAnnotDict->GetStringBy("V"); |
179 if (value.IsEmpty()) { | 179 if (value.IsEmpty()) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 if (pBorderArray) { | 281 if (pBorderArray) { |
282 width = pBorderArray->GetNumberAt(2); | 282 width = pBorderArray->GetNumberAt(2); |
283 if (pBorderArray->GetCount() == 4) { | 283 if (pBorderArray->GetCount() == 4) { |
284 pDashArray = pBorderArray->GetArrayAt(3); | 284 pDashArray = pBorderArray->GetArrayAt(3); |
285 if (!pDashArray) { | 285 if (!pDashArray) { |
286 return; | 286 return; |
287 } | 287 } |
288 int nLen = pDashArray->GetCount(); | 288 int nLen = pDashArray->GetCount(); |
289 int i = 0; | 289 int i = 0; |
290 for (; i < nLen; ++i) { | 290 for (; i < nLen; ++i) { |
291 CPDF_Object* pObj = pDashArray->GetElementValue(i); | 291 CPDF_Object* pObj = pDashArray->GetDirectObjectAt(i); |
292 if (pObj && pObj->GetInteger()) { | 292 if (pObj && pObj->GetInteger()) { |
293 break; | 293 break; |
294 } | 294 } |
295 } | 295 } |
296 if (i == nLen) { | 296 if (i == nLen) { |
297 return; | 297 return; |
298 } | 298 } |
299 style_char = 'D'; | 299 style_char = 'D'; |
300 } | 300 } |
301 } else { | 301 } else { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 CFX_PathData path; | 346 CFX_PathData path; |
347 width /= 2; | 347 width /= 2; |
348 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, | 348 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, |
349 rect.top - width); | 349 rect.top - width); |
350 int fill_type = 0; | 350 int fill_type = 0; |
351 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { | 351 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { |
352 fill_type |= FXFILL_NOPATHSMOOTH; | 352 fill_type |= FXFILL_NOPATHSMOOTH; |
353 } | 353 } |
354 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); | 354 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); |
355 } | 355 } |
OLD | NEW |