Chromium Code Reviews| 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/cpdf_modulemgr.h" | 9 #include "core/fpdfapi/cpdf_modulemgr.h" |
| 10 #include "core/fpdfapi/page/cpdf_image.h" | 10 #include "core/fpdfapi/page/cpdf_image.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 for (int index = 0; index < nCount; index++) { | 38 for (int index = 0; index < nCount; index++) { |
| 39 CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); | 39 CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); |
| 40 if (pPage) | 40 if (pPage) |
| 41 pImgObj->GetImage()->ResetCache(pPage, nullptr); | 41 pImgObj->GetImage()->ResetCache(pPage, nullptr); |
| 42 } | 42 } |
| 43 pImgObj->GetImage()->SetJpegImage(pFile); | 43 pImgObj->GetImage()->SetJpegImage(pFile); |
| 44 | 44 |
| 45 return true; | 45 return true; |
| 46 } | 46 } |
| 47 | 47 |
| 48 DLLEXPORT FPDF_BOOL STDCALL | |
| 49 FPDFImageObj_LoadJpegFileInline(FPDF_PAGE* pages, | |
|
weili
2016/12/13 21:55:01
Can this and FPDFImageObj_LoadJpegFile() share com
rbpotter
2016/12/14 01:03:28
Done.
| |
| 50 int nCount, | |
| 51 FPDF_PAGEOBJECT image_object, | |
| 52 FPDF_FILEACCESS* fileAccess) { | |
| 53 if (!image_object || !fileAccess || !pages) | |
| 54 return false; | |
| 55 | |
| 56 CFX_RetainPtr<IFX_SeekableReadStream> pFile = | |
| 57 MakeSeekableReadStream(fileAccess); | |
| 58 CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object); | |
| 59 for (int index = 0; index < nCount; index++) { | |
| 60 CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); | |
| 61 if (pPage) | |
| 62 pImgObj->GetImage()->ResetCache(pPage, nullptr); | |
| 63 } | |
| 64 pImgObj->GetImage()->SetJpegImageInline(pFile); | |
| 65 | |
| 66 return true; | |
| 67 } | |
| 68 | |
| 48 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, | 69 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, |
| 49 double a, | 70 double a, |
| 50 double b, | 71 double b, |
| 51 double c, | 72 double c, |
| 52 double d, | 73 double d, |
| 53 double e, | 74 double e, |
| 54 double f) { | 75 double f) { |
| 55 if (!image_object) | 76 if (!image_object) |
| 56 return false; | 77 return false; |
| 57 | 78 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 74 CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object); | 95 CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object); |
| 75 for (int index = 0; index < nCount; index++) { | 96 for (int index = 0; index < nCount; index++) { |
| 76 CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); | 97 CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); |
| 77 if (pPage) | 98 if (pPage) |
| 78 pImgObj->GetImage()->ResetCache(pPage, nullptr); | 99 pImgObj->GetImage()->ResetCache(pPage, nullptr); |
| 79 } | 100 } |
| 80 pImgObj->GetImage()->SetImage(reinterpret_cast<CFX_DIBitmap*>(bitmap)); | 101 pImgObj->GetImage()->SetImage(reinterpret_cast<CFX_DIBitmap*>(bitmap)); |
| 81 pImgObj->CalcBoundingBox(); | 102 pImgObj->CalcBoundingBox(); |
| 82 return true; | 103 return true; |
| 83 } | 104 } |
| OLD | NEW |