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 // static | |
138 bool CPDF_Annot::IsAnnotationHidden(CPDF_Dictionary* pAnnotDict) { | |
139 return pAnnotDict->GetIntegerBy("F") & ANNOTFLAG_HIDDEN; | |
Lei Zhang
2016/08/16 02:27:36
Looks like MSVC isn't happy with this. You need to
| |
140 } | |
141 | |
136 FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage, | 142 FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage, |
137 CFX_RenderDevice* pDevice, | 143 CFX_RenderDevice* pDevice, |
138 const CFX_Matrix* pUser2Device, | 144 const CFX_Matrix* pUser2Device, |
139 AppearanceMode mode, | 145 AppearanceMode mode, |
140 const CPDF_RenderOptions* pOptions) { | 146 const CPDF_RenderOptions* pOptions) { |
147 if (IsAnnotationHidden(m_pAnnotDict)) | |
148 return FALSE; | |
149 | |
141 CFX_Matrix matrix; | 150 CFX_Matrix matrix; |
142 CPDF_Form* pForm = | 151 CPDF_Form* pForm = |
143 FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix); | 152 FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix); |
144 if (!pForm) { | 153 if (!pForm) { |
145 return FALSE; | 154 return FALSE; |
146 } | 155 } |
147 CPDF_RenderContext context(pPage); | 156 CPDF_RenderContext context(pPage); |
148 context.AppendLayer(pForm, &matrix); | 157 context.AppendLayer(pForm, &matrix); |
149 context.Render(pDevice, pOptions, nullptr); | 158 context.Render(pDevice, pOptions, nullptr); |
150 return TRUE; | 159 return TRUE; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 CFX_PathData path; | 264 CFX_PathData path; |
256 width /= 2; | 265 width /= 2; |
257 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, | 266 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, |
258 rect.top - width); | 267 rect.top - width); |
259 int fill_type = 0; | 268 int fill_type = 0; |
260 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { | 269 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { |
261 fill_type |= FXFILL_NOPATHSMOOTH; | 270 fill_type |= FXFILL_NOPATHSMOOTH; |
262 } | 271 } |
263 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); | 272 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); |
264 } | 273 } |
OLD | NEW |