| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/fpdfdoc/cpdf_annot.h" | 7 #include "core/fpdfdoc/cpdf_annot.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_page/cpdf_form.h" | 9 #include "core/fpdfapi/fpdf_page/cpdf_form.h" |
| 10 #include "core/fpdfapi/fpdf_page/cpdf_page.h" | 10 #include "core/fpdfapi/fpdf_page/cpdf_page.h" |
| 11 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" | 11 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" |
| 12 #include "core/fpdfapi/fpdf_parser/cpdf_document.h" | 12 #include "core/fpdfapi/fpdf_parser/cpdf_document.h" |
| 13 #include "core/fpdfapi/fpdf_render/cpdf_rendercontext.h" | 13 #include "core/fpdfapi/fpdf_render/cpdf_rendercontext.h" |
| 14 #include "core/fpdfapi/fpdf_render/cpdf_renderoptions.h" | 14 #include "core/fpdfapi/fpdf_render/cpdf_renderoptions.h" |
| 15 #include "core/fpdfdoc/cpvt_generateap.h" | 15 #include "core/fpdfdoc/cpvt_generateap.h" |
| 16 #include "core/fxcrt/fx_memory.h" | 16 #include "core/fxcrt/fx_memory.h" |
| 17 #include "core/fxge/cfx_graphstatedata.h" | 17 #include "core/fxge/cfx_graphstatedata.h" |
| 18 #include "core/fxge/cfx_pathdata.h" | 18 #include "core/fxge/cfx_pathdata.h" |
| 19 #include "core/fxge/cfx_renderdevice.h" | 19 #include "core/fxge/cfx_renderdevice.h" |
| 20 #include "third_party/base/ptr_util.h" |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 char kPDFiumKey_HasGeneratedAP[] = "PDFIUM_HasGeneratedAP"; | 24 char kPDFiumKey_HasGeneratedAP[] = "PDFIUM_HasGeneratedAP"; |
| 24 | 25 |
| 25 bool IsTextMarkupAnnotation(CPDF_Annot::Subtype type) { | 26 bool IsTextMarkupAnnotation(CPDF_Annot::Subtype type) { |
| 26 return type == CPDF_Annot::Subtype::HIGHLIGHT || | 27 return type == CPDF_Annot::Subtype::HIGHLIGHT || |
| 27 type == CPDF_Annot::Subtype::SQUIGGLY || | 28 type == CPDF_Annot::Subtype::SQUIGGLY || |
| 28 type == CPDF_Annot::Subtype::STRIKEOUT || | 29 type == CPDF_Annot::Subtype::STRIKEOUT || |
| 29 type == CPDF_Annot::Subtype::UNDERLINE; | 30 type == CPDF_Annot::Subtype::UNDERLINE; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 if (!pStream) | 177 if (!pStream) |
| 177 return nullptr; | 178 return nullptr; |
| 178 | 179 |
| 179 auto it = m_APMap.find(pStream); | 180 auto it = m_APMap.find(pStream); |
| 180 if (it != m_APMap.end()) | 181 if (it != m_APMap.end()) |
| 181 return it->second.get(); | 182 return it->second.get(); |
| 182 | 183 |
| 183 CPDF_Form* pNewForm = | 184 CPDF_Form* pNewForm = |
| 184 new CPDF_Form(m_pDocument, pPage->m_pResources, pStream); | 185 new CPDF_Form(m_pDocument, pPage->m_pResources, pStream); |
| 185 pNewForm->ParseContent(nullptr, nullptr, nullptr); | 186 pNewForm->ParseContent(nullptr, nullptr, nullptr); |
| 186 m_APMap[pStream] = WrapUnique(pNewForm); | 187 m_APMap[pStream] = pdfium::WrapUnique(pNewForm); |
| 187 return pNewForm; | 188 return pNewForm; |
| 188 } | 189 } |
| 189 | 190 |
| 190 static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage, | 191 static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage, |
| 191 CPDF_Annot* pAnnot, | 192 CPDF_Annot* pAnnot, |
| 192 CPDF_Annot::AppearanceMode mode, | 193 CPDF_Annot::AppearanceMode mode, |
| 193 const CFX_Matrix* pUser2Device, | 194 const CFX_Matrix* pUser2Device, |
| 194 CFX_Matrix& matrix) { | 195 CFX_Matrix& matrix) { |
| 195 CPDF_Form* pForm = pAnnot->GetAPForm(pPage, mode); | 196 CPDF_Form* pForm = pAnnot->GetAPForm(pPage, mode); |
| 196 if (!pForm) { | 197 if (!pForm) { |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 CFX_PathData path; | 490 CFX_PathData path; |
| 490 width /= 2; | 491 width /= 2; |
| 491 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, | 492 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, |
| 492 rect.top - width); | 493 rect.top - width); |
| 493 int fill_type = 0; | 494 int fill_type = 0; |
| 494 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { | 495 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { |
| 495 fill_type |= FXFILL_NOPATHSMOOTH; | 496 fill_type |= FXFILL_NOPATHSMOOTH; |
| 496 } | 497 } |
| 497 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); | 498 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); |
| 498 } | 499 } |
| OLD | NEW |