| 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 23 matching lines...) Expand all Loading... |
| 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); |
| 43 } | 43 } |
| 44 m_AnnotList.push_back(new CPDF_Annot(pDict, this)); | 44 m_AnnotList.push_back( |
| 45 std::unique_ptr<CPDF_Annot>(new CPDF_Annot(pDict, this))); |
| 45 if (bRegenerateAP && pDict->GetStringBy("Subtype") == "Widget" && | 46 if (bRegenerateAP && pDict->GetStringBy("Subtype") == "Widget" && |
| 46 CPDF_InterForm::UpdatingAPEnabled()) { | 47 CPDF_InterForm::UpdatingAPEnabled()) { |
| 47 FPDF_GenerateAP(m_pDocument, pDict); | 48 FPDF_GenerateAP(m_pDocument, pDict); |
| 48 } | 49 } |
| 49 } | 50 } |
| 50 } | 51 } |
| 51 | 52 |
| 52 CPDF_AnnotList::~CPDF_AnnotList() { | 53 CPDF_AnnotList::~CPDF_AnnotList() {} |
| 53 for (CPDF_Annot* annot : m_AnnotList) | |
| 54 delete annot; | |
| 55 } | |
| 56 | 54 |
| 57 void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage, | 55 void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage, |
| 58 CFX_RenderDevice* pDevice, | 56 CFX_RenderDevice* pDevice, |
| 59 CPDF_RenderContext* pContext, | 57 CPDF_RenderContext* pContext, |
| 60 FX_BOOL bPrinting, | 58 FX_BOOL bPrinting, |
| 61 CFX_Matrix* pMatrix, | 59 CFX_Matrix* pMatrix, |
| 62 FX_BOOL bWidgetPass, | 60 FX_BOOL bWidgetPass, |
| 63 CPDF_RenderOptions* pOptions, | 61 CPDF_RenderOptions* pOptions, |
| 64 FX_RECT* clip_rect) { | 62 FX_RECT* clip_rect) { |
| 65 for (CPDF_Annot* pAnnot : m_AnnotList) { | 63 for (const auto& pAnnot : m_AnnotList) { |
| 66 bool bWidget = pAnnot->GetSubType() == "Widget"; | 64 bool bWidget = pAnnot->GetSubType() == "Widget"; |
| 67 if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget)) | 65 if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget)) |
| 68 continue; | 66 continue; |
| 69 | 67 |
| 70 uint32_t annot_flags = pAnnot->GetFlags(); | 68 uint32_t annot_flags = pAnnot->GetFlags(); |
| 71 if (annot_flags & ANNOTFLAG_HIDDEN) | 69 if (annot_flags & ANNOTFLAG_HIDDEN) |
| 72 continue; | 70 continue; |
| 73 | 71 |
| 74 if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) | 72 if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) |
| 75 continue; | 73 continue; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 CFX_PathData path; | 346 CFX_PathData path; |
| 349 width /= 2; | 347 width /= 2; |
| 350 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, | 348 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, |
| 351 rect.top - width); | 349 rect.top - width); |
| 352 int fill_type = 0; | 350 int fill_type = 0; |
| 353 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { | 351 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { |
| 354 fill_type |= FXFILL_NOPATHSMOOTH; | 352 fill_type |= FXFILL_NOPATHSMOOTH; |
| 355 } | 353 } |
| 356 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); | 354 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); |
| 357 } | 355 } |
| OLD | NEW |