Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: fpdfsdk/src/fpdfeditpage.cpp

Issue 1519693002: Merge to XFA: Remove CFX_AffineMatrix/CPDF_Matrix (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: XFA-specific changes Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 double a, 252 double a,
253 double b, 253 double b,
254 double c, 254 double c,
255 double d, 255 double d,
256 double e, 256 double e,
257 double f) { 257 double f) {
258 CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object; 258 CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object;
259 if (!pPageObj) 259 if (!pPageObj)
260 return; 260 return;
261 261
262 CFX_AffineMatrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, 262 CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
263 (FX_FLOAT)e, (FX_FLOAT)f); 263 (FX_FLOAT)e, (FX_FLOAT)f);
264 pPageObj->Transform(matrix); 264 pPageObj->Transform(matrix);
265 } 265 }
266 DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, 266 DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
267 double a, 267 double a,
268 double b, 268 double b,
269 double c, 269 double c,
270 double d, 270 double d,
271 double e, 271 double e,
272 double f) { 272 double f) {
273 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 273 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
274 if (!pPage) 274 if (!pPage)
275 return; 275 return;
276 CPDF_AnnotList AnnotList(pPage); 276 CPDF_AnnotList AnnotList(pPage);
277 for (size_t i = 0; i < AnnotList.Count(); ++i) { 277 for (size_t i = 0; i < AnnotList.Count(); ++i) {
278 CPDF_Annot* pAnnot = AnnotList.GetAt(i); 278 CPDF_Annot* pAnnot = AnnotList.GetAt(i);
279 // transformAnnots Rectangle 279 // transformAnnots Rectangle
280 CPDF_Rect rect; 280 CPDF_Rect rect;
281 pAnnot->GetRect(rect); 281 pAnnot->GetRect(rect);
282 CFX_AffineMatrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, 282 CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
283 (FX_FLOAT)e, (FX_FLOAT)f); 283 (FX_FLOAT)e, (FX_FLOAT)f);
284 rect.Transform(&matrix); 284 rect.Transform(&matrix);
285 CPDF_Array* pRectArray = NULL; 285 CPDF_Array* pRectArray = NULL;
286 pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect"); 286 pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect");
287 if (!pRectArray) 287 if (!pRectArray)
288 pRectArray = CPDF_Array::Create(); 288 pRectArray = CPDF_Array::Create();
289 pRectArray->SetAt(0, new CPDF_Number(rect.left)); 289 pRectArray->SetAt(0, new CPDF_Number(rect.left));
290 pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); 290 pRectArray->SetAt(1, new CPDF_Number(rect.bottom));
291 pRectArray->SetAt(2, new CPDF_Number(rect.right)); 291 pRectArray->SetAt(2, new CPDF_Number(rect.right));
292 pRectArray->SetAt(3, new CPDF_Number(rect.top)); 292 pRectArray->SetAt(3, new CPDF_Number(rect.top));
293 pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray); 293 pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray);
294 294
295 // Transform AP's rectangle 295 // Transform AP's rectangle
296 // To Do 296 // To Do
297 } 297 }
298 } 298 }
299 299
300 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { 300 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) {
301 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 301 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
302 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || 302 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
303 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || 303 !pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
304 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( 304 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
305 "Page")) { 305 "Page")) {
306 return; 306 return;
307 } 307 }
308 CPDF_Dictionary* pDict = pPage->m_pFormDict; 308 CPDF_Dictionary* pDict = pPage->m_pFormDict;
309 rotate %= 4; 309 rotate %= 4;
310 310
311 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); 311 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90));
312 } 312 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698