| 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_flatten.h" | 7 #include "../../public/fpdf_flatten.h" |
| 8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
| 9 | 9 |
| 10 typedef CFX_ArrayTemplate<CPDF_Dictionary*> CPDF_ObjectArray; | 10 typedef CFX_ArrayTemplate<CPDF_Dictionary*> CPDF_ObjectArray; |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 FX_FLOAT left = FX_MIN(FX_MIN(x1, x2), FX_MIN(x3, x4)); | 303 FX_FLOAT left = FX_MIN(FX_MIN(x1, x2), FX_MIN(x3, x4)); |
| 304 FX_FLOAT bottom = FX_MIN(FX_MIN(y1, y2), FX_MIN(y3, y4)); | 304 FX_FLOAT bottom = FX_MIN(FX_MIN(y1, y2), FX_MIN(y3, y4)); |
| 305 | 305 |
| 306 fa = (rcAnnot.right - rcAnnot.left) / fStreamWidth; | 306 fa = (rcAnnot.right - rcAnnot.left) / fStreamWidth; |
| 307 fd = (rcAnnot.top - rcAnnot.bottom) / fStreamHeight; | 307 fd = (rcAnnot.top - rcAnnot.bottom) / fStreamHeight; |
| 308 fe = rcAnnot.left - left * fa; | 308 fe = rcAnnot.left - left * fa; |
| 309 ff = rcAnnot.bottom - bottom * fd; | 309 ff = rcAnnot.bottom - bottom * fd; |
| 310 } | 310 } |
| 311 | 311 |
| 312 DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { | 312 DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { |
| 313 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
| 313 if (!page) { | 314 if (!page) { |
| 314 return FLATTEN_FAIL; | 315 return FLATTEN_FAIL; |
| 315 } | 316 } |
| 316 | 317 |
| 317 CPDF_Page* pPage = (CPDF_Page*)(page); | |
| 318 CPDF_Document* pDocument = pPage->m_pDocument; | 318 CPDF_Document* pDocument = pPage->m_pDocument; |
| 319 CPDF_Dictionary* pPageDict = pPage->m_pFormDict; | 319 CPDF_Dictionary* pPageDict = pPage->m_pFormDict; |
| 320 | 320 |
| 321 if (!pDocument || !pPageDict) { | 321 if (!pDocument || !pPageDict) { |
| 322 return FLATTEN_FAIL; | 322 return FLATTEN_FAIL; |
| 323 } | 323 } |
| 324 | 324 |
| 325 CPDF_ObjectArray ObjectArray; | 325 CPDF_ObjectArray ObjectArray; |
| 326 CPDF_RectArray RectArray; | 326 CPDF_RectArray RectArray; |
| 327 | 327 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, | 517 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, |
| 518 FALSE); | 518 FALSE); |
| 519 } | 519 } |
| 520 pPageDict->RemoveAt("Annots"); | 520 pPageDict->RemoveAt("Annots"); |
| 521 | 521 |
| 522 ObjectArray.RemoveAll(); | 522 ObjectArray.RemoveAll(); |
| 523 RectArray.RemoveAll(); | 523 RectArray.RemoveAll(); |
| 524 | 524 |
| 525 return FLATTEN_SUCCESS; | 525 return FLATTEN_SUCCESS; |
| 526 } | 526 } |
| OLD | NEW |