summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_shadingpattern.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/page/cpdf_shadingpattern.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_shadingpattern.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/core/fpdfapi/page/cpdf_shadingpattern.cpp b/core/fpdfapi/page/cpdf_shadingpattern.cpp
index 133d32ff3a..dae5ec356c 100644
--- a/core/fpdfapi/page/cpdf_shadingpattern.cpp
+++ b/core/fpdfapi/page/cpdf_shadingpattern.cpp
@@ -31,27 +31,23 @@ CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc,
CPDF_Object* pPatternObj,
bool bShading,
const CFX_Matrix& parentMatrix)
- : CPDF_Pattern(SHADING,
- pDoc,
- bShading ? nullptr : pPatternObj,
- parentMatrix),
+ : CPDF_Pattern(pDoc, bShading ? nullptr : pPatternObj, parentMatrix),
m_ShadingType(kInvalidShading),
m_bShadingObj(bShading),
m_pShadingObj(pPatternObj),
m_pCS(nullptr),
m_pCountedCS(nullptr) {
+ assert(document());
if (!bShading) {
- CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
- m_Pattern2Form = pDict->GetMatrixFor("Matrix");
- m_pShadingObj = pDict->GetDirectObjectFor("Shading");
- m_Pattern2Form.Concat(parentMatrix);
+ m_pShadingObj = pattern_obj()->GetDict()->GetDirectObjectFor("Shading");
+ SetPatternToFormMatrix();
}
}
CPDF_ShadingPattern::~CPDF_ShadingPattern() {
CPDF_ColorSpace* pCS = m_pCountedCS ? m_pCountedCS->get() : nullptr;
- if (pCS && m_pDocument) {
- auto* pPageData = m_pDocument->GetPageData();
+ if (pCS) {
+ auto* pPageData = document()->GetPageData();
if (pPageData)
pPageData->ReleaseColorSpace(pCS->GetArray());
}
@@ -89,7 +85,7 @@ bool CPDF_ShadingPattern::Load() {
if (!pCSObj)
return false;
- CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
+ CPDF_DocPageData* pDocPageData = document()->GetPageData();
m_pCS = pDocPageData->GetColorSpace(pCSObj, nullptr);
if (m_pCS)
m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());