Chromium Code Reviews| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 m_pShadingObj = pDict->GetDirectObjectBy("Shading"); | 42 m_pShadingObj = pDict->GetDirectObjectBy("Shading"); |
| 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 CPDF_TilingPattern* CPDF_ShadingPattern::AsTilingPattern() { | |
|
Lei Zhang
2016/06/13 20:48:41
need blank line above
Wei Li
2016/06/13 21:38:03
Done.
| |
| 53 return nullptr; | |
| 54 } | |
| 55 | |
| 56 CPDF_ShadingPattern* CPDF_ShadingPattern::AsShadingPattern() { | |
| 57 return this; | |
| 58 } | |
| 52 | 59 |
| 53 bool CPDF_ShadingPattern::Load() { | 60 bool CPDF_ShadingPattern::Load() { |
| 54 if (m_ShadingType != kInvalidShading) | 61 if (m_ShadingType != kInvalidShading) |
| 55 return TRUE; | 62 return TRUE; |
| 56 | 63 |
| 57 CPDF_Dictionary* pShadingDict = | 64 CPDF_Dictionary* pShadingDict = |
| 58 m_pShadingObj ? m_pShadingObj->GetDict() : nullptr; | 65 m_pShadingObj ? m_pShadingObj->GetDict() : nullptr; |
| 59 if (!pShadingDict) | 66 if (!pShadingDict) |
| 60 return FALSE; | 67 return FALSE; |
| 61 | 68 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 80 m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray()); | 87 m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray()); |
| 81 | 88 |
| 82 m_ShadingType = ToShadingType(pShadingDict->GetIntegerBy("ShadingType")); | 89 m_ShadingType = ToShadingType(pShadingDict->GetIntegerBy("ShadingType")); |
| 83 | 90 |
| 84 // We expect to have a stream if our shading type is a mesh. | 91 // We expect to have a stream if our shading type is a mesh. |
| 85 if (IsMeshShading() && !ToStream(m_pShadingObj)) | 92 if (IsMeshShading() && !ToStream(m_pShadingObj)) |
| 86 return FALSE; | 93 return FALSE; |
| 87 | 94 |
| 88 return TRUE; | 95 return TRUE; |
| 89 } | 96 } |
| OLD | NEW |