xref: /aosp_15_r20/external/pdfium/core/fpdfapi/page/cpdf_pattern.cpp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2016 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "core/fpdfapi/page/cpdf_pattern.h"
8 
9 #include <utility>
10 
11 #include "core/fpdfapi/parser/cpdf_dictionary.h"
12 #include "third_party/base/check.h"
13 
CPDF_Pattern(CPDF_Document * pDoc,RetainPtr<CPDF_Object> pObj,const CFX_Matrix & parentMatrix)14 CPDF_Pattern::CPDF_Pattern(CPDF_Document* pDoc,
15                            RetainPtr<CPDF_Object> pObj,
16                            const CFX_Matrix& parentMatrix)
17     : m_pDocument(pDoc),
18       m_pPatternObj(std::move(pObj)),
19       m_ParentMatrix(parentMatrix) {
20   DCHECK(m_pDocument);
21   DCHECK(m_pPatternObj);
22 }
23 
24 CPDF_Pattern::~CPDF_Pattern() = default;
25 
AsTilingPattern()26 CPDF_TilingPattern* CPDF_Pattern::AsTilingPattern() {
27   return nullptr;
28 }
29 
AsShadingPattern()30 CPDF_ShadingPattern* CPDF_Pattern::AsShadingPattern() {
31   return nullptr;
32 }
33 
SetPatternToFormMatrix()34 void CPDF_Pattern::SetPatternToFormMatrix() {
35   RetainPtr<const CPDF_Dictionary> pDict = pattern_obj()->GetDict();
36   m_Pattern2Form = pDict->GetMatrixFor("Matrix") * m_ParentMatrix;
37 }
38