| 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/include/fpdfdoc/fpdf_ap.h" | 7 #include "core/include/fpdfdoc/fpdf_ap.h" |
| 8 #include "core/include/fpdfdoc/fpdf_doc.h" | 8 #include "core/include/fpdfdoc/fpdf_doc.h" |
| 9 #include "core/include/fpdfdoc/fpdf_vt.h" | 9 #include "core/include/fpdfdoc/fpdf_vt.h" |
| 10 #include "doc_utils.h" | 10 #include "doc_utils.h" |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 rcBody.Normalize(); | 420 rcBody.Normalize(); |
| 421 CPDF_Dictionary* pAPDict = pAnnotDict->GetDict("AP"); | 421 CPDF_Dictionary* pAPDict = pAnnotDict->GetDict("AP"); |
| 422 if (pAPDict == NULL) { | 422 if (pAPDict == NULL) { |
| 423 pAPDict = CPDF_Dictionary::Create(); | 423 pAPDict = CPDF_Dictionary::Create(); |
| 424 if (pAPDict == NULL) { | 424 if (pAPDict == NULL) { |
| 425 return FALSE; | 425 return FALSE; |
| 426 } | 426 } |
| 427 pAnnotDict->SetAt("AP", pAPDict); | 427 pAnnotDict->SetAt("AP", pAPDict); |
| 428 } | 428 } |
| 429 CPDF_Stream* pNormalStream = pAPDict->GetStream("N"); | 429 CPDF_Stream* pNormalStream = pAPDict->GetStream("N"); |
| 430 if (pNormalStream == NULL) { | 430 if (!pNormalStream) { |
| 431 pNormalStream = CPDF_Stream::Create(NULL, 0, NULL); | 431 pNormalStream = new CPDF_Stream(nullptr, 0, nullptr); |
| 432 if (pNormalStream == NULL) { | |
| 433 return FALSE; | |
| 434 } | |
| 435 int32_t objnum = pDoc->AddIndirectObject(pNormalStream); | 432 int32_t objnum = pDoc->AddIndirectObject(pNormalStream); |
| 436 pAnnotDict->GetDict("AP")->SetAtReference("N", pDoc, objnum); | 433 pAnnotDict->GetDict("AP")->SetAtReference("N", pDoc, objnum); |
| 437 } | 434 } |
| 438 CPDF_Dictionary* pStreamDict = pNormalStream->GetDict(); | 435 CPDF_Dictionary* pStreamDict = pNormalStream->GetDict(); |
| 439 if (pStreamDict) { | 436 if (pStreamDict) { |
| 440 pStreamDict->SetAtMatrix("Matrix", matrix); | 437 pStreamDict->SetAtMatrix("Matrix", matrix); |
| 441 pStreamDict->SetAtRect("BBox", rcBBox); | 438 pStreamDict->SetAtRect("BBox", rcBBox); |
| 442 CPDF_Dictionary* pStreamResList = pStreamDict->GetDict("Resources"); | 439 CPDF_Dictionary* pStreamResList = pStreamDict->GetDict("Resources"); |
| 443 if (pStreamResList) { | 440 if (pStreamResList) { |
| 444 CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDict("Font"); | 441 CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDict("Font"); |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 << "\n"; | 926 << "\n"; |
| 930 break; | 927 break; |
| 931 case CT_CMYK: | 928 case CT_CMYK: |
| 932 sColorStream << color.fColor1 << " " << color.fColor2 << " " | 929 sColorStream << color.fColor1 << " " << color.fColor2 << " " |
| 933 << color.fColor3 << " " << color.fColor4 << " " | 930 << color.fColor3 << " " << color.fColor4 << " " |
| 934 << (bFillOrStroke ? "k" : "K") << "\n"; | 931 << (bFillOrStroke ? "k" : "K") << "\n"; |
| 935 break; | 932 break; |
| 936 } | 933 } |
| 937 return sColorStream.GetByteString(); | 934 return sColorStream.GetByteString(); |
| 938 } | 935 } |
| OLD | NEW |