| 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 "../../include/fpdfdoc/fpdf_doc.h" | 7 #include "../../include/fpdfdoc/fpdf_doc.h" |
| 8 #include "../../include/fpdfapi/fpdf_pageobj.h" | 8 #include "../../include/fpdfapi/fpdf_pageobj.h" |
| 9 CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) | 9 CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) |
| 10 { | 10 { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 if (dwObjNum == 0) { | 30 if (dwObjNum == 0) { |
| 31 dwObjNum = m_pDocument->AddIndirectObject(pDict); | 31 dwObjNum = m_pDocument->AddIndirectObject(pDict); |
| 32 CPDF_Reference* pAction = CPDF_Reference::Create(m_pDocument, dwObjN
um); | 32 CPDF_Reference* pAction = CPDF_Reference::Create(m_pDocument, dwObjN
um); |
| 33 if (pAction == NULL) { | 33 if (pAction == NULL) { |
| 34 break; | 34 break; |
| 35 } | 35 } |
| 36 pAnnots->InsertAt(i, pAction); | 36 pAnnots->InsertAt(i, pAction); |
| 37 pAnnots->RemoveAt(i + 1); | 37 pAnnots->RemoveAt(i + 1); |
| 38 pDict = pAnnots->GetDict(i); | 38 pDict = pAnnots->GetDict(i); |
| 39 } | 39 } |
| 40 CPDF_Annot* pAnnot = FX_NEW CPDF_Annot(pDict); | 40 CPDF_Annot* pAnnot = new CPDF_Annot(pDict); |
| 41 if (pAnnot == NULL) { | |
| 42 break; | |
| 43 } | |
| 44 pAnnot->m_pList = this; | 41 pAnnot->m_pList = this; |
| 45 m_AnnotList.Add(pAnnot); | 42 m_AnnotList.Add(pAnnot); |
| 46 if (bRegenerateAP && pDict->GetConstString(FX_BSTRC("Subtype")) == FX_BS
TRC("Widget")) | 43 if (bRegenerateAP && pDict->GetConstString(FX_BSTRC("Subtype")) == FX_BS
TRC("Widget")) |
| 47 if (CPDF_InterForm::UpdatingAPEnabled()) { | 44 if (CPDF_InterForm::UpdatingAPEnabled()) { |
| 48 FPDF_GenerateAP(m_pDocument, pDict); | 45 FPDF_GenerateAP(m_pDocument, pDict); |
| 49 } | 46 } |
| 50 } | 47 } |
| 51 } | 48 } |
| 52 CPDF_AnnotList::~CPDF_AnnotList() | 49 CPDF_AnnotList::~CPDF_AnnotList() |
| 53 { | 50 { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) | 215 CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) |
| 219 { | 216 { |
| 220 CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pAnnotDict, mode); | 217 CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pAnnotDict, mode); |
| 221 if (pStream == NULL) { | 218 if (pStream == NULL) { |
| 222 return NULL; | 219 return NULL; |
| 223 } | 220 } |
| 224 CPDF_Form* pForm; | 221 CPDF_Form* pForm; |
| 225 if (m_APMap.Lookup(pStream, (void*&)pForm)) { | 222 if (m_APMap.Lookup(pStream, (void*&)pForm)) { |
| 226 return pForm; | 223 return pForm; |
| 227 } | 224 } |
| 228 pForm = FX_NEW CPDF_Form(m_pList->m_pDocument, pPage->m_pResources, pStream)
; | 225 pForm = new CPDF_Form(m_pList->m_pDocument, pPage->m_pResources, pStream); |
| 229 if (pForm == NULL) { | |
| 230 return NULL; | |
| 231 } | |
| 232 pForm->ParseContent(NULL, NULL, NULL, NULL); | 226 pForm->ParseContent(NULL, NULL, NULL, NULL); |
| 233 m_APMap.SetAt(pStream, pForm); | 227 m_APMap.SetAt(pStream, pForm); |
| 234 return pForm; | 228 return pForm; |
| 235 } | 229 } |
| 236 static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage, CPDF_Annot* pA
nnot, CPDF_Annot::AppearanceMode mode, const CFX_AffineMatrix* pUser2Device, CFX
_Matrix &matrix) | 230 static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage, CPDF_Annot* pA
nnot, CPDF_Annot::AppearanceMode mode, const CFX_AffineMatrix* pUser2Device, CFX
_Matrix &matrix) |
| 237 { | 231 { |
| 238 CPDF_Form* pForm = pAnnot->GetAPForm(pPage, mode); | 232 CPDF_Form* pForm = pAnnot->GetAPForm(pPage, mode); |
| 239 if (!pForm) { | 233 if (!pForm) { |
| 240 return NULL; | 234 return NULL; |
| 241 } | 235 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 return NULL; | 310 return NULL; |
| 317 } | 311 } |
| 318 CPDF_Array* pColor = m_pAnnotDict->GetArray("C"); | 312 CPDF_Array* pColor = m_pAnnotDict->GetArray("C"); |
| 319 FX_DWORD argb = 0xff000000; | 313 FX_DWORD argb = 0xff000000; |
| 320 if (pColor != NULL) { | 314 if (pColor != NULL) { |
| 321 int R = (FX_INT32)(pColor->GetNumber(0) * 255); | 315 int R = (FX_INT32)(pColor->GetNumber(0) * 255); |
| 322 int G = (FX_INT32)(pColor->GetNumber(1) * 255); | 316 int G = (FX_INT32)(pColor->GetNumber(1) * 255); |
| 323 int B = (FX_INT32)(pColor->GetNumber(2) * 255); | 317 int B = (FX_INT32)(pColor->GetNumber(2) * 255); |
| 324 argb = ArgbEncode(0xff, R, G, B); | 318 argb = ArgbEncode(0xff, R, G, B); |
| 325 } | 319 } |
| 326 CPDF_PathObject *pPathObject = FX_NEW CPDF_PathObject(); | 320 CPDF_PathObject *pPathObject = new CPDF_PathObject(); |
| 327 if (!pPathObject) { | |
| 328 return NULL; | |
| 329 } | |
| 330 CPDF_GraphStateData *pGraphState = pPathObject->m_GraphState.GetModify(); | 321 CPDF_GraphStateData *pGraphState = pPathObject->m_GraphState.GetModify(); |
| 331 if (!pGraphState) { | 322 if (!pGraphState) { |
| 332 pPathObject->Release(); | 323 pPathObject->Release(); |
| 333 return NULL; | 324 return NULL; |
| 334 } | 325 } |
| 335 pGraphState->m_LineWidth = width; | 326 pGraphState->m_LineWidth = width; |
| 336 CPDF_ColorStateData *pColorData = pPathObject->m_ColorState.GetModify(); | 327 CPDF_ColorStateData *pColorData = pPathObject->m_ColorState.GetModify(); |
| 337 if (!pColorData) { | 328 if (!pColorData) { |
| 338 pPathObject->Release(); | 329 pPathObject->Release(); |
| 339 return NULL; | 330 return NULL; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 if (pIRT != m_pAnnotDict) { | 502 if (pIRT != m_pAnnotDict) { |
| 512 continue; | 503 continue; |
| 513 } | 504 } |
| 514 if (count == index) { | 505 if (count == index) { |
| 515 return pAnnot; | 506 return pAnnot; |
| 516 } | 507 } |
| 517 count ++; | 508 count ++; |
| 518 } | 509 } |
| 519 return NULL; | 510 return NULL; |
| 520 } | 511 } |
| OLD | NEW |