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

Unified Diff: core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp

Issue 2494683007: Fix sevg above CPDF_PageContentGenerator::ProcessImage() (Closed)
Patch Set: Use IsInline() Created 4 years, 1 month 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 | « no previous file | fpdfsdk/fpdfeditimg_unittest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index ad1ffaf6873a95216727a6817260ab160fc15d46..20b4ea6eaf850afdae71f6d54fb57a3d1b1abc4d 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -94,16 +94,21 @@ void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf,
return;
}
buf << "q " << pImageObj->m_Matrix << " cm ";
+
CPDF_Image* pImage = pImageObj->GetImage();
- if (!pImage->IsInline()) {
- CPDF_Stream* pStream = pImage->GetStream();
- uint32_t dwSavedObjNum = pStream->GetObjNum();
- CFX_ByteString name = RealizeResource(pStream, "XObject");
- if (dwSavedObjNum == 0) {
- pImageObj->SetUnownedImage(m_pDocument->GetPageData()->GetImage(pStream));
- }
- buf << "/" << PDF_NameEncode(name) << " Do Q\n";
- }
+ if (pImage->IsInline())
+ return;
+
+ CPDF_Stream* pStream = pImage->GetStream();
+ if (!pStream)
+ return;
+
+ bool bWasInline = pStream->IsInline();
+ CFX_ByteString name = RealizeResource(pStream, "XObject");
+ if (bWasInline)
+ pImageObj->SetUnownedImage(m_pDocument->GetPageData()->GetImage(pStream));
+
+ buf << "/" << PDF_NameEncode(name) << " Do Q\n";
}
void CPDF_PageContentGenerator::ProcessForm(CFX_ByteTextBuf& buf,
« no previous file with comments | « no previous file | fpdfsdk/fpdfeditimg_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698