diff options
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r-- | core/fpdfapi/page/cpdf_colorspace.cpp | 10 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_docpagedata.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_docpagedata.h | 6 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_iccprofile.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_iccprofile.h | 8 |
5 files changed, 16 insertions, 14 deletions
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp index 4f68329862..354a342d90 100644 --- a/core/fpdfapi/page/cpdf_colorspace.cpp +++ b/core/fpdfapi/page/cpdf_colorspace.cpp @@ -854,7 +854,7 @@ CPDF_ICCBasedCS::CPDF_ICCBasedCS(CPDF_Document* pDoc) CPDF_ICCBasedCS::~CPDF_ICCBasedCS() { if (m_pProfile && m_pDocument) { - CPDF_Stream* pStream = m_pProfile->GetStream(); + const CPDF_Stream* pStream = m_pProfile->GetStream(); m_pProfile.Reset(); // Give up our reference first. auto* pPageData = m_pDocument->GetPageData(); if (pPageData) @@ -865,7 +865,7 @@ CPDF_ICCBasedCS::~CPDF_ICCBasedCS() { uint32_t CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, const CPDF_Array* pArray, std::set<const CPDF_Object*>* pVisited) { - CPDF_Stream* pStream = pArray->GetStreamAt(1); + const CPDF_Stream* pStream = pArray->GetStreamAt(1); if (!pStream) return 0; @@ -1118,13 +1118,13 @@ uint32_t CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, } m_MaxIndex = pArray->GetIntegerAt(2); - CPDF_Object* pTableObj = pArray->GetDirectObjectAt(3); + const CPDF_Object* pTableObj = pArray->GetDirectObjectAt(3); if (!pTableObj) return 0; - if (CPDF_String* pString = pTableObj->AsString()) { + if (const CPDF_String* pString = pTableObj->AsString()) { m_Table = pString->GetString(); - } else if (CPDF_Stream* pStream = pTableObj->AsStream()) { + } else if (const CPDF_Stream* pStream = pTableObj->AsStream()) { auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream); pAcc->LoadAllDataFiltered(); m_Table = ByteStringView(pAcc->GetData(), pAcc->GetSize()); diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp index 9ac5c1e304..79e148c72a 100644 --- a/core/fpdfapi/page/cpdf_docpagedata.cpp +++ b/core/fpdfapi/page/cpdf_docpagedata.cpp @@ -421,7 +421,7 @@ void CPDF_DocPageData::MaybePurgeImage(uint32_t dwStreamObjNum) { } RetainPtr<CPDF_IccProfile> CPDF_DocPageData::GetIccProfile( - CPDF_Stream* pProfileStream) { + const CPDF_Stream* pProfileStream) { if (!pProfileStream) return nullptr; @@ -449,7 +449,7 @@ RetainPtr<CPDF_IccProfile> CPDF_DocPageData::GetIccProfile( return pProfile; } -void CPDF_DocPageData::MaybePurgeIccProfile(CPDF_Stream* pProfileStream) { +void CPDF_DocPageData::MaybePurgeIccProfile(const CPDF_Stream* pProfileStream) { ASSERT(pProfileStream); auto it = m_IccProfileMap.find(pProfileStream); if (it != m_IccProfileMap.end() && it->second->HasOneRef()) diff --git a/core/fpdfapi/page/cpdf_docpagedata.h b/core/fpdfapi/page/cpdf_docpagedata.h index 2d22ee991d..04b77cf3ed 100644 --- a/core/fpdfapi/page/cpdf_docpagedata.h +++ b/core/fpdfapi/page/cpdf_docpagedata.h @@ -61,8 +61,8 @@ class CPDF_DocPageData { RetainPtr<CPDF_Image> GetImage(uint32_t dwStreamObjNum); void MaybePurgeImage(uint32_t dwStreamObjNum); - RetainPtr<CPDF_IccProfile> GetIccProfile(CPDF_Stream* pProfileStream); - void MaybePurgeIccProfile(CPDF_Stream* pProfileStream); + RetainPtr<CPDF_IccProfile> GetIccProfile(const CPDF_Stream* pProfileStream); + void MaybePurgeIccProfile(const CPDF_Stream* pProfileStream); RetainPtr<CPDF_StreamAcc> GetFontFileStreamAcc(CPDF_Stream* pFontStream); void MaybePurgeFontFileStreamAcc(const CPDF_Stream* pFontStream); @@ -86,7 +86,7 @@ class CPDF_DocPageData { bool m_bForceClear; UnownedPtr<CPDF_Document> const m_pPDFDoc; - std::map<ByteString, CPDF_Stream*> m_HashProfileMap; + std::map<ByteString, const CPDF_Stream*> m_HashProfileMap; std::map<const CPDF_Object*, CPDF_CountedColorSpace*> m_ColorSpaceMap; std::map<const CPDF_Stream*, RetainPtr<CPDF_StreamAcc>> m_FontFileMap; std::map<const CPDF_Dictionary*, CPDF_CountedFont*> m_FontMap; diff --git a/core/fpdfapi/page/cpdf_iccprofile.cpp b/core/fpdfapi/page/cpdf_iccprofile.cpp index 144f530a2c..c0bf7cd2a2 100644 --- a/core/fpdfapi/page/cpdf_iccprofile.cpp +++ b/core/fpdfapi/page/cpdf_iccprofile.cpp @@ -18,7 +18,7 @@ bool DetectSRGB(const uint8_t* pData, uint32_t dwSize) { } // namespace -CPDF_IccProfile::CPDF_IccProfile(CPDF_Stream* pStream, +CPDF_IccProfile::CPDF_IccProfile(const CPDF_Stream* pStream, const uint8_t* pData, uint32_t dwSize) : m_bsRGB(DetectSRGB(pData, dwSize)), m_pStream(pStream) { diff --git a/core/fpdfapi/page/cpdf_iccprofile.h b/core/fpdfapi/page/cpdf_iccprofile.h index 1bc498aa1f..a5c9f6dbfe 100644 --- a/core/fpdfapi/page/cpdf_iccprofile.h +++ b/core/fpdfapi/page/cpdf_iccprofile.h @@ -20,7 +20,7 @@ class CPDF_IccProfile : public Retainable { template <typename T, typename... Args> friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); - CPDF_Stream* GetStream() const { return m_pStream.Get(); } + const CPDF_Stream* GetStream() const { return m_pStream.Get(); } bool IsValid() const { return IsSRGB() || IsSupported(); } bool IsSRGB() const { return m_bsRGB; } bool IsSupported() const { return !!m_Transform; } @@ -28,11 +28,13 @@ class CPDF_IccProfile : public Retainable { uint32_t GetComponents() const { return m_nSrcComponents; } private: - CPDF_IccProfile(CPDF_Stream* pStream, const uint8_t* pData, uint32_t dwSize); + CPDF_IccProfile(const CPDF_Stream* pStream, + const uint8_t* pData, + uint32_t dwSize); ~CPDF_IccProfile() override; const bool m_bsRGB; - UnownedPtr<CPDF_Stream> const m_pStream; + UnownedPtr<const CPDF_Stream> const m_pStream; std::unique_ptr<CLcmsCmm> m_Transform; uint32_t m_nSrcComponents = 0; }; |