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 "public/fpdf_flatten.h" | 7 #include "public/fpdf_flatten.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 if (!pSourceDoc || !pPageDic) | 89 if (!pSourceDoc || !pPageDic) |
90 return FLATTEN_FAIL; | 90 return FLATTEN_FAIL; |
91 | 91 |
92 GetContentsRect(pSourceDoc, pPageDic, pRectArray); | 92 GetContentsRect(pSourceDoc, pPageDic, pRectArray); |
93 CPDF_Array* pAnnots = pPageDic->GetArrayBy("Annots"); | 93 CPDF_Array* pAnnots = pPageDic->GetArrayBy("Annots"); |
94 if (!pAnnots) | 94 if (!pAnnots) |
95 return FLATTEN_NOTHINGTODO; | 95 return FLATTEN_NOTHINGTODO; |
96 | 96 |
97 uint32_t dwSize = pAnnots->GetCount(); | 97 uint32_t dwSize = pAnnots->GetCount(); |
98 for (int i = 0; i < (int)dwSize; i++) { | 98 for (int i = 0; i < (int)dwSize; i++) { |
99 CPDF_Dictionary* pAnnotDic = ToDictionary(pAnnots->GetElementValue(i)); | 99 CPDF_Dictionary* pAnnotDic = ToDictionary(pAnnots->GetDirectObjectAt(i)); |
100 if (!pAnnotDic) | 100 if (!pAnnotDic) |
101 continue; | 101 continue; |
102 | 102 |
103 CFX_ByteString sSubtype = pAnnotDic->GetStringBy("Subtype"); | 103 CFX_ByteString sSubtype = pAnnotDic->GetStringBy("Subtype"); |
104 if (sSubtype == "Popup") | 104 if (sSubtype == "Popup") |
105 continue; | 105 continue; |
106 | 106 |
107 int nAnnotFlag = pAnnotDic->GetIntegerBy("F"); | 107 int nAnnotFlag = pAnnotDic->GetIntegerBy("F"); |
108 if (nAnnotFlag & ANNOTFLAG_HIDDEN) | 108 if (nAnnotFlag & ANNOTFLAG_HIDDEN) |
109 continue; | 109 continue; |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, | 513 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, |
514 FALSE); | 514 FALSE); |
515 } | 515 } |
516 pPageDict->RemoveAt("Annots"); | 516 pPageDict->RemoveAt("Annots"); |
517 | 517 |
518 ObjectArray.RemoveAll(); | 518 ObjectArray.RemoveAll(); |
519 RectArray.RemoveAll(); | 519 RectArray.RemoveAll(); |
520 | 520 |
521 return FLATTEN_SUCCESS; | 521 return FLATTEN_SUCCESS; |
522 } | 522 } |
OLD | NEW |