| 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/include/cpdf_annot.h" | 7 #include "core/fpdfdoc/include/cpdf_annot.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" |
| 10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 CPVT_GenerateAP::GenerateStrikeOutAP(m_pDocument, m_pAnnotDict); | 44 CPVT_GenerateAP::GenerateStrikeOutAP(m_pDocument, m_pAnnotDict); |
| 45 else if (m_sSubtype == "Text") | 45 else if (m_sSubtype == "Text") |
| 46 CPVT_GenerateAP::GenerateTextAP(m_pDocument, m_pAnnotDict); | 46 CPVT_GenerateAP::GenerateTextAP(m_pDocument, m_pAnnotDict); |
| 47 else if (m_sSubtype == "Underline") | 47 else if (m_sSubtype == "Underline") |
| 48 CPVT_GenerateAP::GenerateUnderlineAP(m_pDocument, m_pAnnotDict); | 48 CPVT_GenerateAP::GenerateUnderlineAP(m_pDocument, m_pAnnotDict); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void CPDF_Annot::ClearCachedAP() { | 51 void CPDF_Annot::ClearCachedAP() { |
| 52 m_APMap.clear(); | 52 m_APMap.clear(); |
| 53 } | 53 } |
| 54 CFX_ByteString CPDF_Annot::GetSubType() const { | 54 CFX_ByteString CPDF_Annot::GetSubtype() const { |
| 55 return m_sSubtype; | 55 return m_sSubtype; |
| 56 } | 56 } |
| 57 | 57 |
| 58 CFX_FloatRect CPDF_Annot::GetRect() const { | 58 CFX_FloatRect CPDF_Annot::GetRect() const { |
| 59 if (!m_pAnnotDict) | 59 if (!m_pAnnotDict) |
| 60 return CFX_FloatRect(); | 60 return CFX_FloatRect(); |
| 61 | 61 |
| 62 CFX_FloatRect rect = m_pAnnotDict->GetRectBy("Rect"); | 62 CFX_FloatRect rect = m_pAnnotDict->GetRectBy("Rect"); |
| 63 rect.Normalize(); | 63 rect.Normalize(); |
| 64 return rect; | 64 return rect; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix); | 179 FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix); |
| 180 if (!pForm) { | 180 if (!pForm) { |
| 181 return FALSE; | 181 return FALSE; |
| 182 } | 182 } |
| 183 pContext->AppendLayer(pForm, &matrix); | 183 pContext->AppendLayer(pForm, &matrix); |
| 184 return TRUE; | 184 return TRUE; |
| 185 } | 185 } |
| 186 void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, | 186 void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, |
| 187 const CFX_Matrix* pUser2Device, | 187 const CFX_Matrix* pUser2Device, |
| 188 const CPDF_RenderOptions* pOptions) { | 188 const CPDF_RenderOptions* pOptions) { |
| 189 if (GetSubType() == "Popup") { | 189 if (GetSubtype() == "Popup") |
| 190 return; | 190 return; |
| 191 } | 191 |
| 192 uint32_t annot_flags = GetFlags(); | 192 uint32_t annot_flags = GetFlags(); |
| 193 if (annot_flags & ANNOTFLAG_HIDDEN) { | 193 if (annot_flags & ANNOTFLAG_HIDDEN) { |
| 194 return; | 194 return; |
| 195 } | 195 } |
| 196 bool bPrinting = pDevice->GetDeviceClass() == FXDC_PRINTER || | 196 bool bPrinting = pDevice->GetDeviceClass() == FXDC_PRINTER || |
| 197 (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW)); | 197 (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW)); |
| 198 if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) { | 198 if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) { |
| 199 return; | 199 return; |
| 200 } | 200 } |
| 201 if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { | 201 if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 CFX_PathData path; | 275 CFX_PathData path; |
| 276 width /= 2; | 276 width /= 2; |
| 277 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, | 277 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, |
| 278 rect.top - width); | 278 rect.top - width); |
| 279 int fill_type = 0; | 279 int fill_type = 0; |
| 280 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { | 280 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { |
| 281 fill_type |= FXFILL_NOPATHSMOOTH; | 281 fill_type |= FXFILL_NOPATHSMOOTH; |
| 282 } | 282 } |
| 283 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); | 283 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); |
| 284 } | 284 } |
| OLD | NEW |