Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(812)

Unified Diff: core/fpdfapi/page/cpdf_image.cpp

Issue 2529543003: Add inline JPEGs. (Closed)
Patch Set: Return to 2 functions Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/page/cpdf_image.h ('k') | fpdfsdk/fpdfeditimg.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f4b28724301ffb1fd34bd0a4226f2426741437b1 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -117,7 +117,8 @@ std::unique_ptr<CPDF_Dictionary> CPDF_Image::InitJPEG(uint8_t* pData,
}
void CPDF_Image::SetJpegImage(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) {
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+ bool inlineImage) {
Wei Li 2016/12/14 19:01:19 |inlineImage| is no longer needed
uint32_t size = pdfium::base::checked_cast<uint32_t>(pFile->GetSize());
if (!size)
return;
@@ -140,6 +141,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 = pdfium::base::checked_cast<uint32_t>(pFile->GetSize());
+ 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));
+}
+
void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap) {
int32_t BitmapWidth = pBitmap->GetWidth();
int32_t BitmapHeight = pBitmap->GetHeight();
« no previous file with comments | « core/fpdfapi/page/cpdf_image.h ('k') | fpdfsdk/fpdfeditimg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698