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