Chromium Code Reviews| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 } | 126 } |
| 127 CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectBy("BBox"); | 127 CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectBy("BBox"); |
| 128 CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix"); | 128 CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix"); |
| 129 form_matrix.TransformRect(form_bbox); | 129 form_matrix.TransformRect(form_bbox); |
| 130 CFX_FloatRect arect; | 130 CFX_FloatRect arect; |
| 131 pAnnot->GetRect(arect); | 131 pAnnot->GetRect(arect); |
| 132 matrix.MatchRect(arect, form_bbox); | 132 matrix.MatchRect(arect, form_bbox); |
| 133 matrix.Concat(*pUser2Device); | 133 matrix.Concat(*pUser2Device); |
| 134 return pForm; | 134 return pForm; |
| 135 } | 135 } |
| 136 | |
| 137 FX_BOOL CPDF_Annot::IsAnnotationHidden(CPDF_Dictionary* pAnnotDict) { | |
|
dsinclair
2016/08/15 13:39:00
Add a // static. comment before the method.
tonikitoo
2016/08/15 13:51:02
Done.
| |
| 138 return pAnnotDict->GetIntegerBy("F") & ANNOTFLAG_HIDDEN; | |
| 139 } | |
| 140 | |
| 136 FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage, | 141 FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage, |
| 137 CFX_RenderDevice* pDevice, | 142 CFX_RenderDevice* pDevice, |
| 138 const CFX_Matrix* pUser2Device, | 143 const CFX_Matrix* pUser2Device, |
| 139 AppearanceMode mode, | 144 AppearanceMode mode, |
| 140 const CPDF_RenderOptions* pOptions) { | 145 const CPDF_RenderOptions* pOptions) { |
| 146 if (IsAnnotationHidden(m_pAnnotDict)) | |
| 147 return FALSE; | |
| 148 | |
| 141 CFX_Matrix matrix; | 149 CFX_Matrix matrix; |
| 142 CPDF_Form* pForm = | 150 CPDF_Form* pForm = |
| 143 FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix); | 151 FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix); |
| 144 if (!pForm) { | 152 if (!pForm) { |
| 145 return FALSE; | 153 return FALSE; |
| 146 } | 154 } |
| 147 CPDF_RenderContext context(pPage); | 155 CPDF_RenderContext context(pPage); |
| 148 context.AppendLayer(pForm, &matrix); | 156 context.AppendLayer(pForm, &matrix); |
| 149 context.Render(pDevice, pOptions, nullptr); | 157 context.Render(pDevice, pOptions, nullptr); |
| 150 return TRUE; | 158 return TRUE; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 CFX_PathData path; | 263 CFX_PathData path; |
| 256 width /= 2; | 264 width /= 2; |
| 257 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, | 265 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, |
| 258 rect.top - width); | 266 rect.top - width); |
| 259 int fill_type = 0; | 267 int fill_type = 0; |
| 260 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { | 268 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { |
| 261 fill_type |= FXFILL_NOPATHSMOOTH; | 269 fill_type |= FXFILL_NOPATHSMOOTH; |
| 262 } | 270 } |
| 263 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); | 271 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); |
| 264 } | 272 } |
| OLD | NEW |