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" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 m_bOpenState(false), | 50 m_bOpenState(false), |
51 m_pPopupAnnot(nullptr) { | 51 m_pPopupAnnot(nullptr) { |
52 m_nSubtype = StringToAnnotSubtype(m_pAnnotDict->GetStringFor("Subtype")); | 52 m_nSubtype = StringToAnnotSubtype(m_pAnnotDict->GetStringFor("Subtype")); |
53 m_bIsTextMarkupAnnotation = IsTextMarkupAnnotation(m_nSubtype); | 53 m_bIsTextMarkupAnnotation = IsTextMarkupAnnotation(m_nSubtype); |
54 m_bHasGeneratedAP = m_pAnnotDict->GetBooleanFor(kPDFiumKey_HasGeneratedAP); | 54 m_bHasGeneratedAP = m_pAnnotDict->GetBooleanFor(kPDFiumKey_HasGeneratedAP); |
55 GenerateAPIfNeeded(); | 55 GenerateAPIfNeeded(); |
56 } | 56 } |
57 | 57 |
58 CPDF_Annot::~CPDF_Annot() { | 58 CPDF_Annot::~CPDF_Annot() { |
59 if (m_bOwnedAnnotDict) | 59 if (m_bOwnedAnnotDict) |
60 delete m_pAnnotDict; | 60 m_pAnnotDict->Release(); |
61 ClearCachedAP(); | 61 ClearCachedAP(); |
62 } | 62 } |
63 | 63 |
64 void CPDF_Annot::GenerateAPIfNeeded() { | 64 void CPDF_Annot::GenerateAPIfNeeded() { |
65 if (!ShouldGenerateAPForAnnotation(m_pAnnotDict)) | 65 if (!ShouldGenerateAPForAnnotation(m_pAnnotDict)) |
66 return; | 66 return; |
67 | 67 |
68 bool result = false; | 68 bool result = false; |
69 if (m_nSubtype == CPDF_Annot::Subtype::CIRCLE) | 69 if (m_nSubtype == CPDF_Annot::Subtype::CIRCLE) |
70 result = CPVT_GenerateAP::GenerateCircleAP(m_pDocument, m_pAnnotDict); | 70 result = CPVT_GenerateAP::GenerateCircleAP(m_pDocument, m_pAnnotDict); |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 CFX_PathData path; | 490 CFX_PathData path; |
491 width /= 2; | 491 width /= 2; |
492 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, | 492 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, |
493 rect.top - width); | 493 rect.top - width); |
494 int fill_type = 0; | 494 int fill_type = 0; |
495 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { | 495 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { |
496 fill_type |= FXFILL_NOPATHSMOOTH; | 496 fill_type |= FXFILL_NOPATHSMOOTH; |
497 } | 497 } |
498 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); | 498 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); |
499 } | 499 } |
OLD | NEW |