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 <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 double e, | 288 double e, |
289 double f) { | 289 double f) { |
290 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 290 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
291 if (!pPage) | 291 if (!pPage) |
292 return; | 292 return; |
293 | 293 |
294 CPDF_AnnotList AnnotList(pPage); | 294 CPDF_AnnotList AnnotList(pPage); |
295 for (size_t i = 0; i < AnnotList.Count(); ++i) { | 295 for (size_t i = 0; i < AnnotList.Count(); ++i) { |
296 CPDF_Annot* pAnnot = AnnotList.GetAt(i); | 296 CPDF_Annot* pAnnot = AnnotList.GetAt(i); |
297 // transformAnnots Rectangle | 297 // transformAnnots Rectangle |
298 CFX_FloatRect rect; | 298 CFX_FloatRect rect = pAnnot->GetRect(); |
299 pAnnot->GetRect(rect); | |
300 CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, | 299 CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, |
301 (FX_FLOAT)e, (FX_FLOAT)f); | 300 (FX_FLOAT)e, (FX_FLOAT)f); |
302 rect.Transform(&matrix); | 301 rect.Transform(&matrix); |
303 CPDF_Array* pRectArray = pAnnot->GetAnnotDict()->GetArrayBy("Rect"); | 302 CPDF_Array* pRectArray = pAnnot->GetAnnotDict()->GetArrayBy("Rect"); |
304 if (!pRectArray) | 303 if (!pRectArray) |
305 pRectArray = new CPDF_Array; | 304 pRectArray = new CPDF_Array; |
306 pRectArray->SetAt(0, new CPDF_Number(rect.left)); | 305 pRectArray->SetAt(0, new CPDF_Number(rect.left)); |
307 pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); | 306 pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); |
308 pRectArray->SetAt(2, new CPDF_Number(rect.right)); | 307 pRectArray->SetAt(2, new CPDF_Number(rect.right)); |
309 pRectArray->SetAt(3, new CPDF_Number(rect.top)); | 308 pRectArray->SetAt(3, new CPDF_Number(rect.top)); |
310 pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray); | 309 pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray); |
311 | 310 |
312 // Transform AP's rectangle | 311 // Transform AP's rectangle |
313 // To Do | 312 // To Do |
314 } | 313 } |
315 } | 314 } |
316 | 315 |
317 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { | 316 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { |
318 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 317 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
319 if (!IsPageObject(pPage)) | 318 if (!IsPageObject(pPage)) |
320 return; | 319 return; |
321 | 320 |
322 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 321 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
323 rotate %= 4; | 322 rotate %= 4; |
324 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); | 323 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); |
325 } | 324 } |
OLD | NEW |