| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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/fpdfapi/fpdf_page/include/cpdf_form.h" | 7 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" |
| 8 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 8 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 uint32_t CPDF_Annot::GetFlags() const { | 153 uint32_t CPDF_Annot::GetFlags() const { |
| 154 return m_pAnnotDict->GetIntegerBy("F"); | 154 return m_pAnnotDict->GetIntegerBy("F"); |
| 155 } | 155 } |
| 156 | 156 |
| 157 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, | 157 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, |
| 158 CPDF_Annot::AppearanceMode mode) { | 158 CPDF_Annot::AppearanceMode mode) { |
| 159 CPDF_Dictionary* pAP = pAnnotDict->GetDictBy("AP"); | 159 CPDF_Dictionary* pAP = pAnnotDict->GetDictBy("AP"); |
| 160 if (!pAP) { | 160 if (!pAP) { |
| 161 return NULL; | 161 return nullptr; |
| 162 } | 162 } |
| 163 const FX_CHAR* ap_entry = "N"; | 163 const FX_CHAR* ap_entry = "N"; |
| 164 if (mode == CPDF_Annot::Down) | 164 if (mode == CPDF_Annot::Down) |
| 165 ap_entry = "D"; | 165 ap_entry = "D"; |
| 166 else if (mode == CPDF_Annot::Rollover) | 166 else if (mode == CPDF_Annot::Rollover) |
| 167 ap_entry = "R"; | 167 ap_entry = "R"; |
| 168 if (!pAP->KeyExist(ap_entry)) | 168 if (!pAP->KeyExist(ap_entry)) |
| 169 ap_entry = "N"; | 169 ap_entry = "N"; |
| 170 | 170 |
| 171 CPDF_Object* psub = pAP->GetDirectObjectBy(ap_entry); | 171 CPDF_Object* psub = pAP->GetDirectObjectBy(ap_entry); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 return pNewForm; | 208 return pNewForm; |
| 209 } | 209 } |
| 210 | 210 |
| 211 static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage, | 211 static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage, |
| 212 CPDF_Annot* pAnnot, | 212 CPDF_Annot* pAnnot, |
| 213 CPDF_Annot::AppearanceMode mode, | 213 CPDF_Annot::AppearanceMode mode, |
| 214 const CFX_Matrix* pUser2Device, | 214 const CFX_Matrix* pUser2Device, |
| 215 CFX_Matrix& matrix) { | 215 CFX_Matrix& matrix) { |
| 216 CPDF_Form* pForm = pAnnot->GetAPForm(pPage, mode); | 216 CPDF_Form* pForm = pAnnot->GetAPForm(pPage, mode); |
| 217 if (!pForm) { | 217 if (!pForm) { |
| 218 return NULL; | 218 return nullptr; |
| 219 } | 219 } |
| 220 CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectBy("BBox"); | 220 CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectBy("BBox"); |
| 221 CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix"); | 221 CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix"); |
| 222 form_matrix.TransformRect(form_bbox); | 222 form_matrix.TransformRect(form_bbox); |
| 223 CFX_FloatRect arect; | 223 CFX_FloatRect arect; |
| 224 pAnnot->GetRect(arect); | 224 pAnnot->GetRect(arect); |
| 225 matrix.MatchRect(arect, form_bbox); | 225 matrix.MatchRect(arect, form_bbox); |
| 226 matrix.Concat(*pUser2Device); | 226 matrix.Concat(*pUser2Device); |
| 227 return pForm; | 227 return pForm; |
| 228 } | 228 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW)); | 269 (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW)); |
| 270 if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) { | 270 if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) { |
| 271 return; | 271 return; |
| 272 } | 272 } |
| 273 if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { | 273 if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { |
| 274 return; | 274 return; |
| 275 } | 275 } |
| 276 CPDF_Dictionary* pBS = m_pAnnotDict->GetDictBy("BS"); | 276 CPDF_Dictionary* pBS = m_pAnnotDict->GetDictBy("BS"); |
| 277 char style_char; | 277 char style_char; |
| 278 FX_FLOAT width; | 278 FX_FLOAT width; |
| 279 CPDF_Array* pDashArray = NULL; | 279 CPDF_Array* pDashArray = nullptr; |
| 280 if (!pBS) { | 280 if (!pBS) { |
| 281 CPDF_Array* pBorderArray = m_pAnnotDict->GetArrayBy("Border"); | 281 CPDF_Array* pBorderArray = m_pAnnotDict->GetArrayBy("Border"); |
| 282 style_char = 'S'; | 282 style_char = 'S'; |
| 283 if (pBorderArray) { | 283 if (pBorderArray) { |
| 284 width = pBorderArray->GetNumberAt(2); | 284 width = pBorderArray->GetNumberAt(2); |
| 285 if (pBorderArray->GetCount() == 4) { | 285 if (pBorderArray->GetCount() == 4) { |
| 286 pDashArray = pBorderArray->GetArrayAt(3); | 286 pDashArray = pBorderArray->GetArrayAt(3); |
| 287 if (!pDashArray) { | 287 if (!pDashArray) { |
| 288 return; | 288 return; |
| 289 } | 289 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 CFX_PathData path; | 348 CFX_PathData path; |
| 349 width /= 2; | 349 width /= 2; |
| 350 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, | 350 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, |
| 351 rect.top - width); | 351 rect.top - width); |
| 352 int fill_type = 0; | 352 int fill_type = 0; |
| 353 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { | 353 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { |
| 354 fill_type |= FXFILL_NOPATHSMOOTH; | 354 fill_type |= FXFILL_NOPATHSMOOTH; |
| 355 } | 355 } |
| 356 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); | 356 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); |
| 357 } | 357 } |
| OLD | NEW |