| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 263   CPDF_AnnotList AnnotList(pPage); | 263   CPDF_AnnotList AnnotList(pPage); | 
| 264   for (size_t i = 0; i < AnnotList.Count(); ++i) { | 264   for (size_t i = 0; i < AnnotList.Count(); ++i) { | 
| 265     CPDF_Annot* pAnnot = AnnotList.GetAt(i); | 265     CPDF_Annot* pAnnot = AnnotList.GetAt(i); | 
| 266     // transformAnnots Rectangle | 266     // transformAnnots Rectangle | 
| 267     CPDF_Rect rect; | 267     CPDF_Rect rect; | 
| 268     pAnnot->GetRect(rect); | 268     pAnnot->GetRect(rect); | 
| 269     CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, | 269     CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, | 
| 270                       (FX_FLOAT)e, (FX_FLOAT)f); | 270                       (FX_FLOAT)e, (FX_FLOAT)f); | 
| 271     rect.Transform(&matrix); | 271     rect.Transform(&matrix); | 
| 272     CPDF_Array* pRectArray = NULL; | 272     CPDF_Array* pRectArray = NULL; | 
| 273     pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect"); | 273     pRectArray = pAnnot->GetAnnotDict()->GetArrayBy("Rect"); | 
| 274     if (!pRectArray) | 274     if (!pRectArray) | 
| 275       pRectArray = new CPDF_Array; | 275       pRectArray = new CPDF_Array; | 
| 276     pRectArray->SetAt(0, new CPDF_Number(rect.left)); | 276     pRectArray->SetAt(0, new CPDF_Number(rect.left)); | 
| 277     pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); | 277     pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); | 
| 278     pRectArray->SetAt(2, new CPDF_Number(rect.right)); | 278     pRectArray->SetAt(2, new CPDF_Number(rect.right)); | 
| 279     pRectArray->SetAt(3, new CPDF_Number(rect.top)); | 279     pRectArray->SetAt(3, new CPDF_Number(rect.top)); | 
| 280     pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray); | 280     pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray); | 
| 281 | 281 | 
| 282     // Transform AP's rectangle | 282     // Transform AP's rectangle | 
| 283     // To Do | 283     // To Do | 
| 284   } | 284   } | 
| 285 } | 285 } | 
| 286 | 286 | 
| 287 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { | 287 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { | 
| 288   CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 288   CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 
| 289   if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || | 289   if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || | 
| 290       !pPage->m_pFormDict->GetElement("Type")->GetDirect() || | 290       !pPage->m_pFormDict->GetElement("Type")->GetDirect() || | 
| 291       pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( | 291       pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( | 
| 292           "Page")) { | 292           "Page")) { | 
| 293     return; | 293     return; | 
| 294   } | 294   } | 
| 295   CPDF_Dictionary* pDict = pPage->m_pFormDict; | 295   CPDF_Dictionary* pDict = pPage->m_pFormDict; | 
| 296   rotate %= 4; | 296   rotate %= 4; | 
| 297 | 297 | 
| 298   pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); | 298   pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); | 
| 299 } | 299 } | 
| OLD | NEW | 
|---|