| 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/cpdf_shadingpattern.h" | 7 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_page/pageint.h" | 9 #include "core/fpdfapi/fpdf_page/pageint.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 m_Pattern2Form.Concat(parentMatrix); | 43 m_Pattern2Form.Concat(parentMatrix); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 CPDF_ShadingPattern::~CPDF_ShadingPattern() { | 47 CPDF_ShadingPattern::~CPDF_ShadingPattern() { |
| 48 CPDF_ColorSpace* pCS = m_pCountedCS ? m_pCountedCS->get() : nullptr; | 48 CPDF_ColorSpace* pCS = m_pCountedCS ? m_pCountedCS->get() : nullptr; |
| 49 if (pCS && m_pDocument) | 49 if (pCS && m_pDocument) |
| 50 m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); | 50 m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 CPDF_TilingPattern* CPDF_ShadingPattern::AsTilingPattern() { |
| 54 return nullptr; |
| 55 } |
| 56 |
| 57 CPDF_ShadingPattern* CPDF_ShadingPattern::AsShadingPattern() { |
| 58 return this; |
| 59 } |
| 60 |
| 53 bool CPDF_ShadingPattern::Load() { | 61 bool CPDF_ShadingPattern::Load() { |
| 54 if (m_ShadingType != kInvalidShading) | 62 if (m_ShadingType != kInvalidShading) |
| 55 return TRUE; | 63 return TRUE; |
| 56 | 64 |
| 57 CPDF_Dictionary* pShadingDict = | 65 CPDF_Dictionary* pShadingDict = |
| 58 m_pShadingObj ? m_pShadingObj->GetDict() : nullptr; | 66 m_pShadingObj ? m_pShadingObj->GetDict() : nullptr; |
| 59 if (!pShadingDict) | 67 if (!pShadingDict) |
| 60 return FALSE; | 68 return FALSE; |
| 61 | 69 |
| 62 m_pFunctions.clear(); | 70 m_pFunctions.clear(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 80 m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray()); | 88 m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray()); |
| 81 | 89 |
| 82 m_ShadingType = ToShadingType(pShadingDict->GetIntegerBy("ShadingType")); | 90 m_ShadingType = ToShadingType(pShadingDict->GetIntegerBy("ShadingType")); |
| 83 | 91 |
| 84 // We expect to have a stream if our shading type is a mesh. | 92 // We expect to have a stream if our shading type is a mesh. |
| 85 if (IsMeshShading() && !ToStream(m_pShadingObj)) | 93 if (IsMeshShading() && !ToStream(m_pShadingObj)) |
| 86 return FALSE; | 94 return FALSE; |
| 87 | 95 |
| 88 return TRUE; | 96 return TRUE; |
| 89 } | 97 } |
| OLD | NEW |