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

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

Issue 1513363002: Remove CFX_AffineMatrix/CPDF_Matrix (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits 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
« no previous file with comments | « fpdfsdk/src/fpdf_transformpage.cpp ('k') | fpdfsdk/src/fpdfformfill.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 double a, 240 double a,
241 double b, 241 double b,
242 double c, 242 double c,
243 double d, 243 double d,
244 double e, 244 double e,
245 double f) { 245 double f) {
246 CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object; 246 CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object;
247 if (!pPageObj) 247 if (!pPageObj)
248 return; 248 return;
249 249
250 CFX_AffineMatrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, 250 CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
251 (FX_FLOAT)e, (FX_FLOAT)f); 251 (FX_FLOAT)e, (FX_FLOAT)f);
252 pPageObj->Transform(matrix); 252 pPageObj->Transform(matrix);
253 } 253 }
254 DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, 254 DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
255 double a, 255 double a,
256 double b, 256 double b,
257 double c, 257 double c,
258 double d, 258 double d,
259 double e, 259 double e,
260 double f) { 260 double f) {
261 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 261 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
262 if (!pPage) 262 if (!pPage)
263 return; 263 return;
264 CPDF_AnnotList AnnotList(pPage); 264 CPDF_AnnotList AnnotList(pPage);
265 for (size_t i = 0; i < AnnotList.Count(); ++i) { 265 for (size_t i = 0; i < AnnotList.Count(); ++i) {
266 CPDF_Annot* pAnnot = AnnotList.GetAt(i); 266 CPDF_Annot* pAnnot = AnnotList.GetAt(i);
267 // transformAnnots Rectangle 267 // transformAnnots Rectangle
268 CPDF_Rect rect; 268 CPDF_Rect rect;
269 pAnnot->GetRect(rect); 269 pAnnot->GetRect(rect);
270 CFX_AffineMatrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, 270 CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
271 (FX_FLOAT)e, (FX_FLOAT)f); 271 (FX_FLOAT)e, (FX_FLOAT)f);
272 rect.Transform(&matrix); 272 rect.Transform(&matrix);
273 CPDF_Array* pRectArray = NULL; 273 CPDF_Array* pRectArray = NULL;
274 pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect"); 274 pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect");
275 if (!pRectArray) 275 if (!pRectArray)
276 pRectArray = CPDF_Array::Create(); 276 pRectArray = CPDF_Array::Create();
277 pRectArray->SetAt(0, new CPDF_Number(rect.left)); 277 pRectArray->SetAt(0, new CPDF_Number(rect.left));
278 pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); 278 pRectArray->SetAt(1, new CPDF_Number(rect.bottom));
279 pRectArray->SetAt(2, new CPDF_Number(rect.right)); 279 pRectArray->SetAt(2, new CPDF_Number(rect.right));
280 pRectArray->SetAt(3, new CPDF_Number(rect.top)); 280 pRectArray->SetAt(3, new CPDF_Number(rect.top));
281 pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray); 281 pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray);
282 282
283 // Transform AP's rectangle 283 // Transform AP's rectangle
284 // To Do 284 // To Do
285 } 285 }
286 } 286 }
287 287
288 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { 288 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) {
289 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 289 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
290 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || 290 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
291 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || 291 !pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
292 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( 292 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
293 "Page")) { 293 "Page")) {
294 return; 294 return;
295 } 295 }
296 CPDF_Dictionary* pDict = pPage->m_pFormDict; 296 CPDF_Dictionary* pDict = pPage->m_pFormDict;
297 rotate %= 4; 297 rotate %= 4;
298 298
299 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); 299 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90));
300 } 300 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdf_transformpage.cpp ('k') | fpdfsdk/src/fpdfformfill.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698