summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/include/fpdfapi/fpdf_resource.h3
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp4
3 files changed, 5 insertions, 3 deletions
diff --git a/core/include/fpdfapi/fpdf_resource.h b/core/include/fpdfapi/fpdf_resource.h
index a7a644435e..937024c94e 100644
--- a/core/include/fpdfapi/fpdf_resource.h
+++ b/core/include/fpdfapi/fpdf_resource.h
@@ -730,6 +730,7 @@ class CPDF_Pattern : public CFX_Object
public:
virtual ~CPDF_Pattern();
+ void SetForceClear(FX_BOOL bForceClear) { m_bForceClear = bForceClear; }
CPDF_Object* m_pPatternObj;
@@ -741,8 +742,8 @@ public:
CPDF_Document* m_pDocument;
protected:
-
CPDF_Pattern(const CFX_AffineMatrix* pParentMatrix);
+ FX_BOOL m_bForceClear;
};
class CPDF_TilingPattern : public CPDF_Pattern
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 131edbe9b5..77db4534fb 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -229,6 +229,7 @@ void CPDF_DocPageData::Clear(FX_BOOL bForceRelease)
m_PatternMap.GetNextAssoc(pos, ptObj, ptData);
nCount = ptData->m_nCount;
if (bForceRelease || nCount < 2) {
+ ptData->m_Obj->SetForceClear(bForceRelease);
delete ptData->m_Obj;
ptData->m_Obj = NULL;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index bcb8196662..67ea4fee65 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -8,7 +8,7 @@
#include "pageint.h"
CPDF_Pattern::CPDF_Pattern(const CFX_AffineMatrix* pParentMatrix) :
- m_pPatternObj(NULL), m_PatternType(PATTERN_TILING), m_pDocument(NULL)
+ m_pPatternObj(NULL), m_PatternType(PATTERN_TILING), m_pDocument(NULL), m_bForceClear(FALSE)
{
if (pParentMatrix) {
m_ParentMatrix = *pParentMatrix;
@@ -97,7 +97,7 @@ void CPDF_ShadingPattern::Clear()
m_pFunctions[i] = NULL;
}
CPDF_ColorSpace* pCS = m_pCS;
- if (pCS && m_pDocument) {
+ if (!m_bForceClear && pCS && m_pDocument) {
m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
}
m_ShadingType = 0;