| 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 | 8 |
| 9 #include "core/fpdfapi/fpdf_page/include/cpdf_image.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_image.h" |
| 10 #include "core/fpdfapi/fpdf_page/include/cpdf_imageobject.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_imageobject.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 if (!image_object || !fileAccess || !pages) | 31 if (!image_object || !fileAccess || !pages) |
| 32 return FALSE; | 32 return FALSE; |
| 33 | 33 |
| 34 IFX_FileRead* pFile = new CPDF_CustomAccess(fileAccess); | 34 IFX_FileRead* pFile = new CPDF_CustomAccess(fileAccess); |
| 35 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object; | 35 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object; |
| 36 pImgObj->m_GeneralState.GetModify(); | 36 pImgObj->m_GeneralState.GetModify(); |
| 37 for (int index = 0; index < nCount; index++) { | 37 for (int index = 0; index < nCount; index++) { |
| 38 CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); | 38 CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); |
| 39 if (!pPage) | 39 if (!pPage) |
| 40 continue; | 40 continue; |
| 41 pImgObj->m_pImage->ResetCache(pPage, NULL); | 41 pImgObj->m_pImage->ResetCache(pPage, nullptr); |
| 42 } | 42 } |
| 43 pImgObj->m_pImage->SetJpegImage(pFile); | 43 pImgObj->m_pImage->SetJpegImage(pFile); |
| 44 | 44 |
| 45 return TRUE; | 45 return TRUE; |
| 46 } | 46 } |
| 47 | 47 |
| 48 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, | 48 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, |
| 49 double a, | 49 double a, |
| 50 double b, | 50 double b, |
| 51 double c, | 51 double c, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 64 pImgObj->CalcBoundingBox(); | 64 pImgObj->CalcBoundingBox(); |
| 65 return TRUE; | 65 return TRUE; |
| 66 } | 66 } |
| 67 | 67 |
| 68 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, | 68 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, |
| 69 int nCount, | 69 int nCount, |
| 70 FPDF_PAGEOBJECT image_object, | 70 FPDF_PAGEOBJECT image_object, |
| 71 FPDF_BITMAP bitmap) { | 71 FPDF_BITMAP bitmap) { |
| 72 if (!image_object || !bitmap || !pages) | 72 if (!image_object || !bitmap || !pages) |
| 73 return FALSE; | 73 return FALSE; |
| 74 CFX_DIBitmap* pBmp = NULL; | 74 CFX_DIBitmap* pBmp = nullptr; |
| 75 pBmp = (CFX_DIBitmap*)bitmap; | 75 pBmp = (CFX_DIBitmap*)bitmap; |
| 76 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object; | 76 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object; |
| 77 pImgObj->m_GeneralState.GetModify(); | 77 pImgObj->m_GeneralState.GetModify(); |
| 78 for (int index = 0; index < nCount; index++) { | 78 for (int index = 0; index < nCount; index++) { |
| 79 CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); | 79 CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); |
| 80 if (!pPage) | 80 if (!pPage) |
| 81 continue; | 81 continue; |
| 82 pImgObj->m_pImage->ResetCache(pPage, NULL); | 82 pImgObj->m_pImage->ResetCache(pPage, nullptr); |
| 83 } | 83 } |
| 84 pImgObj->m_pImage->SetImage(pBmp, FALSE); | 84 pImgObj->m_pImage->SetImage(pBmp, FALSE); |
| 85 pImgObj->CalcBoundingBox(); | 85 pImgObj->CalcBoundingBox(); |
| 86 return TRUE; | 86 return TRUE; |
| 87 } | 87 } |
| OLD | NEW |