From f41d9dc1ead47a1218e1cd37bd74ec850c8baaa3 Mon Sep 17 00:00:00 2001 From: thestig Date: Fri, 5 Aug 2016 22:34:58 -0700 Subject: Add CPDF_ImageObject::GetImage(). And use it where appropriate. Review-Url: https://codereview.chromium.org/2224623002 --- core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'core/fpdfapi/fpdf_edit') 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"; -- cgit v1.2.3