diff options
author | Lei Zhang <thestig@chromium.org> | 2017-04-26 15:22:00 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-27 23:22:12 +0000 |
commit | 66568bcd683dd7b18672cb3aebca4487e9203519 (patch) | |
tree | 7297841771a796bafd3d0d17dd47b7b0e394d933 /core/fpdfapi/page/cpdf_shadingpattern.cpp | |
parent | ba817506edcb26e0acf497111e7684e39dadaf04 (diff) | |
download | pdfium-66568bcd683dd7b18672cb3aebca4487e9203519.tar.xz |
Assert CPDF_Pattern always has a valid CPDF_Document pointer.
Same for CPDF_DocPageData.
Change-Id: I8f2f559123dbb2f3623d957e4074d5f9d191797f
Reviewed-on: https://pdfium-review.googlesource.com/4501
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_shadingpattern.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_shadingpattern.cpp | 18 |
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()); |