diff options
Diffstat (limited to 'core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp')
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp index 67ea4fee65..467ef9b3f6 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp @@ -83,6 +83,7 @@ CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Object* pPatt for (int i = 0; i < 4; i ++) { m_pFunctions[i] = NULL; } + m_pCountedCS = NULL; } CPDF_ShadingPattern::~CPDF_ShadingPattern() { @@ -96,12 +97,13 @@ void CPDF_ShadingPattern::Clear() } m_pFunctions[i] = NULL; } - CPDF_ColorSpace* pCS = m_pCS; - if (!m_bForceClear && pCS && m_pDocument) { + CPDF_ColorSpace* pCS = m_pCountedCS ? m_pCountedCS->m_Obj : NULL; + if (pCS && m_pDocument) { m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); } m_ShadingType = 0; m_pCS = NULL; + m_pCountedCS = NULL; m_nFuncs = 0; } FX_BOOL CPDF_ShadingPattern::Load() @@ -141,6 +143,9 @@ FX_BOOL CPDF_ShadingPattern::Load() } CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData(); m_pCS = pDocPageData->GetColorSpace(pCSObj, NULL); + if (m_pCS) {
+ m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray()); + } m_ShadingType = pShadingDict->GetInteger(FX_BSTRC("ShadingType")); return TRUE; } |