summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_tilingpattern.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-04-26 15:22:00 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-27 23:22:12 +0000
commit66568bcd683dd7b18672cb3aebca4487e9203519 (patch)
tree7297841771a796bafd3d0d17dd47b7b0e394d933 /core/fpdfapi/page/cpdf_tilingpattern.cpp
parentba817506edcb26e0acf497111e7684e39dadaf04 (diff)
downloadpdfium-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_tilingpattern.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_tilingpattern.cpp22
1 files changed, 11 insertions, 11 deletions
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<float>(fabs(pDict->GetNumberFor("XStep")));
+ m_YStep = static_cast<float>(fabs(pDict->GetNumberFor("YStep")));
- CPDF_Stream* pStream = m_pPatternObj->AsStream();
+ CPDF_Stream* pStream = pattern_obj()->AsStream();
if (!pStream)
return false;
- m_pForm = pdfium::MakeUnique<CPDF_Form>(m_pDocument, nullptr, pStream);
- m_pForm->ParseContent(nullptr, &m_ParentMatrix, nullptr);
+ const CFX_Matrix& matrix = parent_matrix();
+ m_pForm = pdfium::MakeUnique<CPDF_Form>(document(), nullptr, pStream);
+ m_pForm->ParseContent(nullptr, &matrix, nullptr);
m_BBox = pDict->GetRectFor("BBox");
return true;
}