diff options
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r-- | core/fpdfapi/page/cpdf_generalstate.cpp | 11 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_generalstate.h | 6 |
2 files changed, 10 insertions, 7 deletions
diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp index dd5c5af878..513e5ff7a5 100644 --- a/core/fpdfapi/page/cpdf_generalstate.cpp +++ b/core/fpdfapi/page/cpdf_generalstate.cpp @@ -124,12 +124,13 @@ void CPDF_GeneralState::SetTR(CPDF_Object* pObject) { m_Ref.GetPrivateCopy()->m_pTR = pObject; } -CPDF_TransferFunc* CPDF_GeneralState::GetTransferFunc() const { +CFX_RetainPtr<CPDF_TransferFunc> CPDF_GeneralState::GetTransferFunc() const { const StateData* pData = m_Ref.GetObject(); return pData ? pData->m_pTransferFunc : nullptr; } -void CPDF_GeneralState::SetTransferFunc(CPDF_TransferFunc* pFunc) { +void CPDF_GeneralState::SetTransferFunc( + const CFX_RetainPtr<CPDF_TransferFunc>& pFunc) { m_Ref.GetPrivateCopy()->m_pTransferFunc = pFunc; } @@ -277,7 +278,9 @@ CPDF_GeneralState::StateData::StateData(const StateData& that) CPDF_GeneralState::StateData::~StateData() { if (m_pTransferFunc && m_pTransferFunc->m_pPDFDoc) { CPDF_DocRenderData* pDocCache = m_pTransferFunc->m_pPDFDoc->GetRenderData(); - if (pDocCache) - pDocCache->ReleaseTransferFunc(m_pTR); + if (pDocCache) { + m_pTransferFunc.Reset(); // Give up our reference first. + pDocCache->MaybePurgeTransferFunc(m_pTR); + } } } diff --git a/core/fpdfapi/page/cpdf_generalstate.h b/core/fpdfapi/page/cpdf_generalstate.h index 1c5ddee4e0..8de5a36ca6 100644 --- a/core/fpdfapi/page/cpdf_generalstate.h +++ b/core/fpdfapi/page/cpdf_generalstate.h @@ -41,8 +41,8 @@ class CPDF_GeneralState { CPDF_Object* GetTR() const; void SetTR(CPDF_Object* pObject); - CPDF_TransferFunc* GetTransferFunc() const; - void SetTransferFunc(CPDF_TransferFunc* pFunc); + CFX_RetainPtr<CPDF_TransferFunc> GetTransferFunc() const; + void SetTransferFunc(const CFX_RetainPtr<CPDF_TransferFunc>& pFunc); void SetBlendMode(const CFX_ByteString& mode); @@ -88,7 +88,7 @@ class CPDF_GeneralState { float m_StrokeAlpha; float m_FillAlpha; CPDF_Object* m_pTR; - CPDF_TransferFunc* m_pTransferFunc; + CFX_RetainPtr<CPDF_TransferFunc> m_pTransferFunc; CFX_Matrix m_Matrix; int m_RenderIntent; bool m_StrokeAdjust; |