Index: core/fpdfapi/page/cpdf_image.cpp |
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp |
index a17222e3430d39ccf58afc1809d2d9ae436a0909..ba0daf713ac1f8f1a4d3fa1cd0b748c48c10af6e 100644 |
--- a/core/fpdfapi/page/cpdf_image.cpp |
+++ b/core/fpdfapi/page/cpdf_image.cpp |
@@ -140,6 +140,23 @@ void CPDF_Image::SetJpegImage( |
m_pStream->InitStreamFromFile(pFile, std::move(pDict)); |
} |
+void CPDF_Image::SetJpegImageInline( |
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) { |
+ uint32_t size = (uint32_t)pFile->GetSize(); |
weili
2016/12/13 21:55:01
Avoid C-cast here pls
rbpotter
2016/12/14 01:03:28
Done.
|
+ if (!size) |
+ return; |
+ |
+ std::vector<uint8_t> data(size); |
+ if (!pFile->ReadBlock(data.data(), 0, size)) |
+ return; |
+ |
+ std::unique_ptr<CPDF_Dictionary> pDict = InitJPEG(data.data(), size); |
+ if (!pDict) |
+ return; |
+ |
+ m_pStream->InitStream(&(data[0]), size, std::move(pDict)); |
weili
2016/12/13 21:55:00
Seems this line is the only diff with SetJpegImage
rbpotter
2016/12/14 01:03:28
There's actually another diff (the size), but I wa
Wei Li
2016/12/14 01:33:00
Sorry, didn't realize the size diff. Looks like ke
rbpotter
2016/12/14 18:03:36
Done.
|
+} |
+ |
void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap) { |
int32_t BitmapWidth = pBitmap->GetWidth(); |
int32_t BitmapHeight = pBitmap->GetHeight(); |