summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_edit
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-08-05 22:34:58 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-05 22:34:58 -0700
commitf41d9dc1ead47a1218e1cd37bd74ec850c8baaa3 (patch)
treed8d32b58909814f9835898c4a87f03b5bc510e69 /core/fpdfapi/fpdf_edit
parent8ca63de14d522d3d259d74fa43b28b05b02728e8 (diff)
downloadpdfium-f41d9dc1ead47a1218e1cd37bd74ec850c8baaa3.tar.xz
Add CPDF_ImageObject::GetImage().
And use it where appropriate. Review-Url: https://codereview.chromium.org/2224623002
Diffstat (limited to 'core/fpdfapi/fpdf_edit')
-rw-r--r--core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
index 0b87e75f62..a85591ceef 100644
--- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
@@ -58,6 +58,7 @@ void CPDF_PageContentGenerator::GenerateContent() {
m_pDocument->AddIndirectObject(pStream);
pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum());
}
+
CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
CPDF_Object* pResourceObj,
const CFX_ByteString& bsType) {
@@ -84,6 +85,7 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
pResList->SetAtReference(name, m_pDocument, pResourceObj->GetObjNum());
return name;
}
+
void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf,
CPDF_ImageObject* pImageObj) {
if ((pImageObj->m_Matrix.a == 0 && pImageObj->m_Matrix.b == 0) ||
@@ -91,13 +93,13 @@ void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf,
return;
}
buf << "q " << pImageObj->m_Matrix << " cm ";
- if (!pImageObj->m_pImage->IsInline()) {
- CPDF_Stream* pStream = pImageObj->m_pImage->GetStream();
+ 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) {
- if (pImageObj->m_pImage)
- pImageObj->m_pImage->Release();
+ pImage->Release();
pImageObj->m_pImage = m_pDocument->GetPageData()->GetImage(pStream);
}
buf << "/" << PDF_NameEncode(name) << " Do Q\n";