| 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/page/cpdf_allstates.h" | 7 #include "core/fpdfapi/page/cpdf_allstates.h" |
| 8 | 8 |
| 9 #include <algorithm> |
| 10 |
| 9 #include "core/fpdfapi/page/pageint.h" | 11 #include "core/fpdfapi/page/pageint.h" |
| 10 #include "core/fpdfapi/parser/cpdf_array.h" | 12 #include "core/fpdfapi/parser/cpdf_array.h" |
| 11 #include "core/fpdfapi/parser/cpdf_dictionary.h" | 13 #include "core/fpdfapi/parser/cpdf_dictionary.h" |
| 12 #include "core/fxge/cfx_graphstatedata.h" | 14 #include "core/fxge/cfx_graphstatedata.h" |
| 13 | 15 |
| 14 namespace { | 16 namespace { |
| 15 | 17 |
| 16 FX_FLOAT ClipFloat(FX_FLOAT f) { | 18 FX_FLOAT ClipFloat(FX_FLOAT f) { |
| 17 return std::max(0.0f, std::min(1.0f, f)); | 19 return std::max(0.0f, std::min(1.0f, f)); |
| 18 } | 20 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 45 void CPDF_AllStates::SetLineDash(CPDF_Array* pArray, | 47 void CPDF_AllStates::SetLineDash(CPDF_Array* pArray, |
| 46 FX_FLOAT phase, | 48 FX_FLOAT phase, |
| 47 FX_FLOAT scale) { | 49 FX_FLOAT scale) { |
| 48 m_GraphState.SetLineDash(pArray, phase, scale); | 50 m_GraphState.SetLineDash(pArray, phase, scale); |
| 49 } | 51 } |
| 50 | 52 |
| 51 void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, | 53 void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, |
| 52 CPDF_StreamContentParser* pParser) { | 54 CPDF_StreamContentParser* pParser) { |
| 53 for (const auto& it : *pGS) { | 55 for (const auto& it : *pGS) { |
| 54 const CFX_ByteString& key_str = it.first; | 56 const CFX_ByteString& key_str = it.first; |
| 55 CPDF_Object* pElement = it.second; | 57 CPDF_Object* pElement = it.second.get(); |
| 56 CPDF_Object* pObject = pElement ? pElement->GetDirect() : nullptr; | 58 CPDF_Object* pObject = pElement ? pElement->GetDirect() : nullptr; |
| 57 if (!pObject) | 59 if (!pObject) |
| 58 continue; | 60 continue; |
| 59 | 61 |
| 60 uint32_t key = key_str.GetID(); | 62 uint32_t key = key_str.GetID(); |
| 61 switch (key) { | 63 switch (key) { |
| 62 case FXBSTR_ID('L', 'W', 0, 0): | 64 case FXBSTR_ID('L', 'W', 0, 0): |
| 63 m_GraphState.SetLineWidth(pObject->GetNumber()); | 65 m_GraphState.SetLineWidth(pObject->GetNumber()); |
| 64 break; | 66 break; |
| 65 case FXBSTR_ID('L', 'C', 0, 0): | 67 case FXBSTR_ID('L', 'C', 0, 0): |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 case FXBSTR_ID('A', 'I', 'S', 0): | 168 case FXBSTR_ID('A', 'I', 'S', 0): |
| 167 m_GeneralState.SetAlphaSource(!!pObject->GetInteger()); | 169 m_GeneralState.SetAlphaSource(!!pObject->GetInteger()); |
| 168 break; | 170 break; |
| 169 case FXBSTR_ID('T', 'K', 0, 0): | 171 case FXBSTR_ID('T', 'K', 0, 0): |
| 170 m_GeneralState.SetTextKnockout(!!pObject->GetInteger()); | 172 m_GeneralState.SetTextKnockout(!!pObject->GetInteger()); |
| 171 break; | 173 break; |
| 172 } | 174 } |
| 173 } | 175 } |
| 174 m_GeneralState.SetMatrix(m_CTM); | 176 m_GeneralState.SetMatrix(m_CTM); |
| 175 } | 177 } |
| OLD | NEW |