Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp

Issue 1923153002: CPDF_Document::LoadPattern() and friends always have a valid matrix. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@clean_doc2
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_tilingpattern.h ('k') | core/fpdfapi/fpdf_page/fpdf_page_doc.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" 7 #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h"
8 8
9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" 9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
11 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h"
12 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h"
13 13
14 CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, 14 CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc,
15 CPDF_Object* pPatternObj, 15 CPDF_Object* pPatternObj,
16 const CFX_Matrix* parentMatrix) 16 const CFX_Matrix& parentMatrix)
17 : CPDF_Pattern(TILING, pDoc, pPatternObj, parentMatrix) { 17 : CPDF_Pattern(TILING, pDoc, pPatternObj, parentMatrix) {
18 CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); 18 CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
19 m_Pattern2Form = pDict->GetMatrixBy("Matrix"); 19 m_Pattern2Form = pDict->GetMatrixBy("Matrix");
20 m_bColored = pDict->GetIntegerBy("PaintType") == 1; 20 m_bColored = pDict->GetIntegerBy("PaintType") == 1;
21 if (parentMatrix) 21 m_Pattern2Form.Concat(parentMatrix);
22 m_Pattern2Form.Concat(*parentMatrix);
23 } 22 }
24 23
25 CPDF_TilingPattern::~CPDF_TilingPattern() { 24 CPDF_TilingPattern::~CPDF_TilingPattern() {
26 } 25 }
27 26
28 FX_BOOL CPDF_TilingPattern::Load() { 27 FX_BOOL CPDF_TilingPattern::Load() {
29 if (m_pForm) 28 if (m_pForm)
30 return TRUE; 29 return TRUE;
31 30
32 CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); 31 CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
33 if (!pDict) 32 if (!pDict)
34 return FALSE; 33 return FALSE;
35 34
36 m_bColored = pDict->GetIntegerBy("PaintType") == 1; 35 m_bColored = pDict->GetIntegerBy("PaintType") == 1;
37 m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberBy("XStep")); 36 m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberBy("XStep"));
38 m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberBy("YStep")); 37 m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberBy("YStep"));
39 38
40 CPDF_Stream* pStream = m_pPatternObj->AsStream(); 39 CPDF_Stream* pStream = m_pPatternObj->AsStream();
41 if (!pStream) 40 if (!pStream)
42 return FALSE; 41 return FALSE;
43 42
44 m_pForm.reset(new CPDF_Form(m_pDocument, nullptr, pStream)); 43 m_pForm.reset(new CPDF_Form(m_pDocument, nullptr, pStream));
45 m_pForm->ParseContent(nullptr, &m_ParentMatrix, nullptr); 44 m_pForm->ParseContent(nullptr, &m_ParentMatrix, nullptr);
46 m_BBox = pDict->GetRectBy("BBox"); 45 m_BBox = pDict->GetRectBy("BBox");
47 return TRUE; 46 return TRUE;
48 } 47 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_tilingpattern.h ('k') | core/fpdfapi/fpdf_page/fpdf_page_doc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698