| 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 #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 14 matching lines...) Expand all Loading... |
| 25 int nCount, | 25 int nCount, |
| 26 FPDF_PAGEOBJECT image_object, | 26 FPDF_PAGEOBJECT image_object, |
| 27 FPDF_FILEACCESS* fileAccess) { | 27 FPDF_FILEACCESS* fileAccess) { |
| 28 if (!image_object || !fileAccess || !pages) | 28 if (!image_object || !fileAccess || !pages) |
| 29 return FALSE; | 29 return FALSE; |
| 30 | 30 |
| 31 IFX_FileRead* pFile = new CPDF_CustomAccess(fileAccess); | 31 IFX_FileRead* pFile = new CPDF_CustomAccess(fileAccess); |
| 32 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object; | 32 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object; |
| 33 pImgObj->m_GeneralState.GetModify(); | 33 pImgObj->m_GeneralState.GetModify(); |
| 34 for (int index = 0; index < nCount; index++) { | 34 for (int index = 0; index < nCount; index++) { |
| 35 CPDF_Page* pPage = ((CPDFXFA_Page*)pages[index])->GetPDFPage(); | 35 CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); |
| 36 if (!pPage) | 36 if (!pPage) |
| 37 continue; | 37 continue; |
| 38 pImgObj->m_pImage->ResetCache(pPage, NULL); | 38 pImgObj->m_pImage->ResetCache(pPage, NULL); |
| 39 } | 39 } |
| 40 pImgObj->m_pImage->SetJpegImage(pFile); | 40 pImgObj->m_pImage->SetJpegImage(pFile); |
| 41 | 41 |
| 42 return TRUE; | 42 return TRUE; |
| 43 } | 43 } |
| 44 | 44 |
| 45 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, | 45 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 66 int nCount, | 66 int nCount, |
| 67 FPDF_PAGEOBJECT image_object, | 67 FPDF_PAGEOBJECT image_object, |
| 68 FPDF_BITMAP bitmap) { | 68 FPDF_BITMAP bitmap) { |
| 69 if (!image_object || !bitmap || !pages) | 69 if (!image_object || !bitmap || !pages) |
| 70 return FALSE; | 70 return FALSE; |
| 71 CFX_DIBitmap* pBmp = NULL; | 71 CFX_DIBitmap* pBmp = NULL; |
| 72 pBmp = (CFX_DIBitmap*)bitmap; | 72 pBmp = (CFX_DIBitmap*)bitmap; |
| 73 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object; | 73 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object; |
| 74 pImgObj->m_GeneralState.GetModify(); | 74 pImgObj->m_GeneralState.GetModify(); |
| 75 for (int index = 0; index < nCount; index++) { | 75 for (int index = 0; index < nCount; index++) { |
| 76 CPDF_Page* pPage = ((CPDFXFA_Page*)pages[index])->GetPDFPage(); | 76 CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); |
| 77 if (!pPage) | 77 if (!pPage) |
| 78 continue; | 78 continue; |
| 79 pImgObj->m_pImage->ResetCache(pPage, NULL); | 79 pImgObj->m_pImage->ResetCache(pPage, NULL); |
| 80 } | 80 } |
| 81 pImgObj->m_pImage->SetImage(pBmp, FALSE); | 81 pImgObj->m_pImage->SetImage(pBmp, FALSE); |
| 82 pImgObj->CalcBoundingBox(); | 82 pImgObj->CalcBoundingBox(); |
| 83 return TRUE; | 83 return TRUE; |
| 84 } | 84 } |
| OLD | NEW |