From 66568bcd683dd7b18672cb3aebca4487e9203519 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 26 Apr 2017 15:22:00 -0700 Subject: 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 Commit-Queue: Lei Zhang --- core/fpdfapi/page/cpdf_tilingpattern.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'core/fpdfapi/page/cpdf_tilingpattern.cpp') diff --git a/core/fpdfapi/page/cpdf_tilingpattern.cpp b/core/fpdfapi/page/cpdf_tilingpattern.cpp index a68b4423e5..65542a27b5 100644 --- a/core/fpdfapi/page/cpdf_tilingpattern.cpp +++ b/core/fpdfapi/page/cpdf_tilingpattern.cpp @@ -15,11 +15,10 @@ CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, const CFX_Matrix& parentMatrix) - : CPDF_Pattern(TILING, pDoc, pPatternObj, parentMatrix) { - CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); - m_Pattern2Form = pDict->GetMatrixFor("Matrix"); - m_bColored = pDict->GetIntegerFor("PaintType") == 1; - m_Pattern2Form.Concat(parentMatrix); + : CPDF_Pattern(pDoc, pPatternObj, parentMatrix) { + assert(document()); + m_bColored = pattern_obj()->GetDict()->GetIntegerFor("PaintType") == 1; + SetPatternToFormMatrix(); } CPDF_TilingPattern::~CPDF_TilingPattern() {} @@ -36,20 +35,21 @@ bool CPDF_TilingPattern::Load() { if (m_pForm) return true; - CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); + CPDF_Dictionary* pDict = pattern_obj()->GetDict(); if (!pDict) return false; m_bColored = pDict->GetIntegerFor("PaintType") == 1; - m_XStep = (float)fabs(pDict->GetNumberFor("XStep")); - m_YStep = (float)fabs(pDict->GetNumberFor("YStep")); + m_XStep = static_cast(fabs(pDict->GetNumberFor("XStep"))); + m_YStep = static_cast(fabs(pDict->GetNumberFor("YStep"))); - CPDF_Stream* pStream = m_pPatternObj->AsStream(); + CPDF_Stream* pStream = pattern_obj()->AsStream(); if (!pStream) return false; - m_pForm = pdfium::MakeUnique(m_pDocument, nullptr, pStream); - m_pForm->ParseContent(nullptr, &m_ParentMatrix, nullptr); + const CFX_Matrix& matrix = parent_matrix(); + m_pForm = pdfium::MakeUnique(document(), nullptr, pStream); + m_pForm->ParseContent(nullptr, &matrix, nullptr); m_BBox = pDict->GetRectFor("BBox"); return true; } -- cgit v1.2.3