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