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

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

Issue 1411623002: Merge to XFA: Introduce CPDFPageFromFPFDPage() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Stray file. Created 5 years, 2 months 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/include/fsdk_define.h ('k') | fpdfsdk/src/fpdf_progressive.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_flatten.h" 7 #include "../../public/fpdf_flatten.h"
8 #include "../include/fsdk_define.h" 8 #include "../include/fsdk_define.h"
9 #include "../include/fpdfxfa/fpdfxfa_doc.h" 9 #include "../include/fpdfxfa/fpdfxfa_doc.h"
10 #include "../include/fpdfxfa/fpdfxfa_page.h" 10 #include "../include/fpdfxfa/fpdfxfa_page.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 FX_FLOAT left = FX_MIN(FX_MIN(x1, x2), FX_MIN(x3, x4)); 305 FX_FLOAT left = FX_MIN(FX_MIN(x1, x2), FX_MIN(x3, x4));
306 FX_FLOAT bottom = FX_MIN(FX_MIN(y1, y2), FX_MIN(y3, y4)); 306 FX_FLOAT bottom = FX_MIN(FX_MIN(y1, y2), FX_MIN(y3, y4));
307 307
308 fa = (rcAnnot.right - rcAnnot.left) / fStreamWidth; 308 fa = (rcAnnot.right - rcAnnot.left) / fStreamWidth;
309 fd = (rcAnnot.top - rcAnnot.bottom) / fStreamHeight; 309 fd = (rcAnnot.top - rcAnnot.bottom) / fStreamHeight;
310 fe = rcAnnot.left - left * fa; 310 fe = rcAnnot.left - left * fa;
311 ff = rcAnnot.bottom - bottom * fd; 311 ff = rcAnnot.bottom - bottom * fd;
312 } 312 }
313 313
314 DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { 314 DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
315 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
315 if (!page) { 316 if (!page) {
316 return FLATTEN_FAIL; 317 return FLATTEN_FAIL;
317 } 318 }
318 319
319 CPDF_Page* pPage = ((CPDFXFA_Page*)(page))->GetPDFPage();
320 if (!pPage)
321 return FLATTEN_FAIL;
322
323 CPDF_Document* pDocument = pPage->m_pDocument; 320 CPDF_Document* pDocument = pPage->m_pDocument;
324 CPDF_Dictionary* pPageDict = pPage->m_pFormDict; 321 CPDF_Dictionary* pPageDict = pPage->m_pFormDict;
325 322
326 if (!pDocument || !pPageDict) { 323 if (!pDocument || !pPageDict) {
327 return FLATTEN_FAIL; 324 return FLATTEN_FAIL;
328 } 325 }
329 326
330 CPDF_ObjectArray ObjectArray; 327 CPDF_ObjectArray ObjectArray;
331 CPDF_RectArray RectArray; 328 CPDF_RectArray RectArray;
332 329
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, 519 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE,
523 FALSE); 520 FALSE);
524 } 521 }
525 pPageDict->RemoveAt("Annots"); 522 pPageDict->RemoveAt("Annots");
526 523
527 ObjectArray.RemoveAll(); 524 ObjectArray.RemoveAll();
528 RectArray.RemoveAll(); 525 RectArray.RemoveAll();
529 526
530 return FLATTEN_SUCCESS; 527 return FLATTEN_SUCCESS;
531 } 528 }
OLDNEW
« no previous file with comments | « fpdfsdk/include/fsdk_define.h ('k') | fpdfsdk/src/fpdf_progressive.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698