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 "public/fpdf_edit.h" | 7 #include "public/fpdf_edit.h" |
8 | 8 |
9 #include "fpdfsdk/include/fsdk_define.h" | 9 #include "fpdfsdk/include/fsdk_define.h" |
10 #include "public/fpdf_formfill.h" | 10 #include "public/fpdf_formfill.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 pMediaBoxArray->Add(new CPDF_Number(0)); | 73 pMediaBoxArray->Add(new CPDF_Number(0)); |
74 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(width))); | 74 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(width))); |
75 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(height))); | 75 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(height))); |
76 | 76 |
77 pPageDict->SetAt("MediaBox", pMediaBoxArray); | 77 pPageDict->SetAt("MediaBox", pMediaBoxArray); |
78 pPageDict->SetAt("Rotate", new CPDF_Number(0)); | 78 pPageDict->SetAt("Rotate", new CPDF_Number(0)); |
79 pPageDict->SetAt("Resources", new CPDF_Dictionary); | 79 pPageDict->SetAt("Resources", new CPDF_Dictionary); |
80 | 80 |
81 CPDF_Page* pPage = new CPDF_Page; | 81 CPDF_Page* pPage = new CPDF_Page; |
82 pPage->Load(pDoc, pPageDict); | 82 pPage->Load(pDoc, pPageDict); |
83 pPage->ParseContent(); | 83 pPage->ParseContent(nullptr); |
84 | |
85 return pPage; | 84 return pPage; |
86 } | 85 } |
87 | 86 |
88 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) { | 87 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) { |
89 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 88 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
90 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || | 89 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || |
91 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || | 90 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || |
92 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( | 91 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( |
93 "Page")) { | 92 "Page")) { |
94 return -1; | 93 return -1; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || | 290 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || |
292 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( | 291 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( |
293 "Page")) { | 292 "Page")) { |
294 return; | 293 return; |
295 } | 294 } |
296 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 295 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
297 rotate %= 4; | 296 rotate %= 4; |
298 | 297 |
299 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); | 298 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); |
300 } | 299 } |
OLD | NEW |