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/page/cpdf_form.h" | 9 #include "core/fpdfapi/page/cpdf_form.h" |
10 #include "core/fpdfapi/page/cpdf_page.h" | 10 #include "core/fpdfapi/page/cpdf_page.h" |
11 #include "core/fpdfapi/parser/cpdf_array.h" | 11 #include "core/fpdfapi/parser/cpdf_array.h" |
| 12 #include "core/fpdfapi/parser/cpdf_boolean.h" |
12 #include "core/fpdfapi/parser/cpdf_document.h" | 13 #include "core/fpdfapi/parser/cpdf_document.h" |
13 #include "core/fpdfapi/render/cpdf_rendercontext.h" | 14 #include "core/fpdfapi/render/cpdf_rendercontext.h" |
14 #include "core/fpdfapi/render/cpdf_renderoptions.h" | 15 #include "core/fpdfapi/render/cpdf_renderoptions.h" |
15 #include "core/fpdfdoc/cpvt_generateap.h" | 16 #include "core/fpdfdoc/cpvt_generateap.h" |
16 #include "core/fxcrt/fx_memory.h" | 17 #include "core/fxcrt/fx_memory.h" |
17 #include "core/fxge/cfx_graphstatedata.h" | 18 #include "core/fxge/cfx_graphstatedata.h" |
18 #include "core/fxge/cfx_pathdata.h" | 19 #include "core/fxge/cfx_pathdata.h" |
19 #include "core/fxge/cfx_renderdevice.h" | 20 #include "core/fxge/cfx_renderdevice.h" |
20 #include "third_party/base/ptr_util.h" | 21 #include "third_party/base/ptr_util.h" |
21 | 22 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 else if (m_nSubtype == CPDF_Annot::Subtype::SQUIGGLY) | 103 else if (m_nSubtype == CPDF_Annot::Subtype::SQUIGGLY) |
103 result = CPVT_GenerateAP::GenerateSquigglyAP(m_pDocument, m_pAnnotDict); | 104 result = CPVT_GenerateAP::GenerateSquigglyAP(m_pDocument, m_pAnnotDict); |
104 else if (m_nSubtype == CPDF_Annot::Subtype::STRIKEOUT) | 105 else if (m_nSubtype == CPDF_Annot::Subtype::STRIKEOUT) |
105 result = CPVT_GenerateAP::GenerateStrikeOutAP(m_pDocument, m_pAnnotDict); | 106 result = CPVT_GenerateAP::GenerateStrikeOutAP(m_pDocument, m_pAnnotDict); |
106 else if (m_nSubtype == CPDF_Annot::Subtype::TEXT) | 107 else if (m_nSubtype == CPDF_Annot::Subtype::TEXT) |
107 result = CPVT_GenerateAP::GenerateTextAP(m_pDocument, m_pAnnotDict); | 108 result = CPVT_GenerateAP::GenerateTextAP(m_pDocument, m_pAnnotDict); |
108 else if (m_nSubtype == CPDF_Annot::Subtype::UNDERLINE) | 109 else if (m_nSubtype == CPDF_Annot::Subtype::UNDERLINE) |
109 result = CPVT_GenerateAP::GenerateUnderlineAP(m_pDocument, m_pAnnotDict); | 110 result = CPVT_GenerateAP::GenerateUnderlineAP(m_pDocument, m_pAnnotDict); |
110 | 111 |
111 if (result) { | 112 if (result) { |
112 m_pAnnotDict->SetBooleanFor(kPDFiumKey_HasGeneratedAP, result); | 113 m_pAnnotDict->SetNewFor<CPDF_Boolean>(kPDFiumKey_HasGeneratedAP, result); |
113 m_bHasGeneratedAP = result; | 114 m_bHasGeneratedAP = result; |
114 } | 115 } |
115 } | 116 } |
116 | 117 |
117 bool CPDF_Annot::ShouldDrawAnnotation() { | 118 bool CPDF_Annot::ShouldDrawAnnotation() { |
118 if (IsAnnotationHidden(m_pAnnotDict)) | 119 if (IsAnnotationHidden(m_pAnnotDict)) |
119 return false; | 120 return false; |
120 | 121 |
121 if (m_nSubtype == CPDF_Annot::Subtype::POPUP && !m_bOpenState) | 122 if (m_nSubtype == CPDF_Annot::Subtype::POPUP && !m_bOpenState) |
122 return false; | 123 return false; |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 CFX_PathData path; | 497 CFX_PathData path; |
497 width /= 2; | 498 width /= 2; |
498 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, | 499 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, |
499 rect.top - width); | 500 rect.top - width); |
500 int fill_type = 0; | 501 int fill_type = 0; |
501 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { | 502 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { |
502 fill_type |= FXFILL_NOPATHSMOOTH; | 503 fill_type |= FXFILL_NOPATHSMOOTH; |
503 } | 504 } |
504 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); | 505 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); |
505 } | 506 } |
OLD | NEW |