| OLD | NEW |
| 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/include/cpdf_shadingobject.h" | 7 #include "core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" | 9 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" |
| 10 #include "core/fpdfapi/fpdf_page/pageint.h" | 10 #include "core/fpdfapi/fpdf_page/pageint.h" |
| 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 12 | 12 |
| 13 CPDF_ShadingObject::CPDF_ShadingObject() : m_pShading(nullptr) {} | 13 CPDF_ShadingObject::CPDF_ShadingObject() : m_pShading(nullptr) {} |
| 14 | 14 |
| 15 CPDF_ShadingObject::~CPDF_ShadingObject() {} | 15 CPDF_ShadingObject::~CPDF_ShadingObject() {} |
| 16 | 16 |
| 17 CPDF_ShadingObject* CPDF_ShadingObject::Clone() const { | 17 CPDF_ShadingObject* CPDF_ShadingObject::Clone() const { |
| 18 CPDF_ShadingObject* obj = new CPDF_ShadingObject; | 18 CPDF_ShadingObject* obj = new CPDF_ShadingObject; |
| 19 obj->CopyData(this); | 19 obj->CopyData(this); |
| 20 | 20 |
| 21 obj->m_pShading = m_pShading; | 21 obj->m_pShading = m_pShading; |
| 22 if (obj->m_pShading && obj->m_pShading->document()) { | 22 if (obj->m_pShading && obj->m_pShading->document()) { |
| 23 CPDF_DocPageData* pDocPageData = obj->m_pShading->document()->GetPageData(); | 23 CPDF_DocPageData* pDocPageData = obj->m_pShading->document()->GetPageData(); |
| 24 CPDF_Pattern* pattern = pDocPageData->GetPattern( | 24 CPDF_Pattern* pattern = pDocPageData->GetPattern( |
| 25 obj->m_pShading->m_pShadingObj, m_pShading->m_bShadingObj, | 25 obj->m_pShading->GetShadingObject(), m_pShading->IsShadingObject(), |
| 26 obj->m_pShading->parent_matrix()); | 26 obj->m_pShading->parent_matrix()); |
| 27 obj->m_pShading = pattern ? pattern->AsShadingPattern() : nullptr; | 27 obj->m_pShading = pattern ? pattern->AsShadingPattern() : nullptr; |
| 28 } | 28 } |
| 29 obj->m_Matrix = m_Matrix; | 29 obj->m_Matrix = m_Matrix; |
| 30 return obj; | 30 return obj; |
| 31 } | 31 } |
| 32 | 32 |
| 33 void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) { | 33 void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) { |
| 34 if (!m_ClipPath.IsNull()) { | 34 if (!m_ClipPath.IsNull()) { |
| 35 m_ClipPath.GetModify(); | 35 m_ClipPath.GetModify(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 46 void CPDF_ShadingObject::CalcBoundingBox() { | 46 void CPDF_ShadingObject::CalcBoundingBox() { |
| 47 if (m_ClipPath.IsNull()) { | 47 if (m_ClipPath.IsNull()) { |
| 48 return; | 48 return; |
| 49 } | 49 } |
| 50 CFX_FloatRect rect = m_ClipPath.GetClipBox(); | 50 CFX_FloatRect rect = m_ClipPath.GetClipBox(); |
| 51 m_Left = rect.left; | 51 m_Left = rect.left; |
| 52 m_Bottom = rect.bottom; | 52 m_Bottom = rect.bottom; |
| 53 m_Right = rect.right; | 53 m_Right = rect.right; |
| 54 m_Top = rect.top; | 54 m_Top = rect.top; |
| 55 } | 55 } |
| OLD | NEW |