| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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->GetShadingObject(), m_pShading->IsShadingObject(), | 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 CPDF_PageObject::Type CPDF_ShadingObject::GetType() const { |
| 34 return SHADING; |
| 35 } |
| 36 |
| 33 void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) { | 37 void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) { |
| 34 if (!m_ClipPath.IsNull()) { | 38 if (!m_ClipPath.IsNull()) { |
| 35 m_ClipPath.GetModify(); | 39 m_ClipPath.GetModify(); |
| 36 m_ClipPath.Transform(matrix); | 40 m_ClipPath.Transform(matrix); |
| 37 } | 41 } |
| 38 m_Matrix.Concat(matrix); | 42 m_Matrix.Concat(matrix); |
| 39 if (!m_ClipPath.IsNull()) { | 43 if (!m_ClipPath.IsNull()) { |
| 40 CalcBoundingBox(); | 44 CalcBoundingBox(); |
| 41 } else { | 45 } else { |
| 42 matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom); | 46 matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom); |
| 43 } | 47 } |
| 44 } | 48 } |
| 45 | 49 |
| 50 bool CPDF_ShadingObject::IsShading() const { |
| 51 return true; |
| 52 } |
| 53 |
| 54 CPDF_ShadingObject* CPDF_ShadingObject::AsShading() { |
| 55 return this; |
| 56 } |
| 57 |
| 58 const CPDF_ShadingObject* CPDF_ShadingObject::AsShading() const { |
| 59 return this; |
| 60 } |
| 61 |
| 46 void CPDF_ShadingObject::CalcBoundingBox() { | 62 void CPDF_ShadingObject::CalcBoundingBox() { |
| 47 if (m_ClipPath.IsNull()) { | 63 if (m_ClipPath.IsNull()) { |
| 48 return; | 64 return; |
| 49 } | 65 } |
| 50 CFX_FloatRect rect = m_ClipPath.GetClipBox(); | 66 CFX_FloatRect rect = m_ClipPath.GetClipBox(); |
| 51 m_Left = rect.left; | 67 m_Left = rect.left; |
| 52 m_Bottom = rect.bottom; | 68 m_Bottom = rect.bottom; |
| 53 m_Right = rect.right; | 69 m_Right = rect.right; |
| 54 m_Top = rect.top; | 70 m_Top = rect.top; |
| 55 } | 71 } |
| OLD | NEW |