| 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_colorspace.h" | 7 #include "core/fpdfapi/fpdf_page/include/cpdf_colorspace.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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 } | 1022 } |
| 1023 if (m_nBaseComponents) { | 1023 if (m_nBaseComponents) { |
| 1024 if (index == INT_MAX || (index + 1) > INT_MAX / m_nBaseComponents || | 1024 if (index == INT_MAX || (index + 1) > INT_MAX / m_nBaseComponents || |
| 1025 (index + 1) * m_nBaseComponents > (int)m_Table.GetLength()) { | 1025 (index + 1) * m_nBaseComponents > (int)m_Table.GetLength()) { |
| 1026 R = G = B = 0; | 1026 R = G = B = 0; |
| 1027 return FALSE; | 1027 return FALSE; |
| 1028 } | 1028 } |
| 1029 } | 1029 } |
| 1030 CFX_FixedBufGrow<FX_FLOAT, 16> Comps(m_nBaseComponents); | 1030 CFX_FixedBufGrow<FX_FLOAT, 16> Comps(m_nBaseComponents); |
| 1031 FX_FLOAT* comps = Comps; | 1031 FX_FLOAT* comps = Comps; |
| 1032 const uint8_t* pTable = m_Table; | 1032 const uint8_t* pTable = m_Table.raw_str(); |
| 1033 for (int i = 0; i < m_nBaseComponents; i++) { | 1033 for (int i = 0; i < m_nBaseComponents; i++) { |
| 1034 comps[i] = | 1034 comps[i] = |
| 1035 m_pCompMinMax[i * 2] + | 1035 m_pCompMinMax[i * 2] + |
| 1036 m_pCompMinMax[i * 2 + 1] * pTable[index * m_nBaseComponents + i] / 255; | 1036 m_pCompMinMax[i * 2 + 1] * pTable[index * m_nBaseComponents + i] / 255; |
| 1037 } | 1037 } |
| 1038 return m_pBaseCS->GetRGB(comps, R, G, B); | 1038 return m_pBaseCS->GetRGB(comps, R, G, B); |
| 1039 } | 1039 } |
| 1040 | 1040 |
| 1041 CPDF_ColorSpace* CPDF_IndexedCS::GetBaseCS() const { | 1041 CPDF_ColorSpace* CPDF_IndexedCS::GetBaseCS() const { |
| 1042 return m_pBaseCS; | 1042 return m_pBaseCS; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 } | 1244 } |
| 1245 return m_pAltCS->GetRGB(results, R, G, B); | 1245 return m_pAltCS->GetRGB(results, R, G, B); |
| 1246 } | 1246 } |
| 1247 | 1247 |
| 1248 void CPDF_DeviceNCS::EnableStdConversion(FX_BOOL bEnabled) { | 1248 void CPDF_DeviceNCS::EnableStdConversion(FX_BOOL bEnabled) { |
| 1249 CPDF_ColorSpace::EnableStdConversion(bEnabled); | 1249 CPDF_ColorSpace::EnableStdConversion(bEnabled); |
| 1250 if (m_pAltCS) { | 1250 if (m_pAltCS) { |
| 1251 m_pAltCS->EnableStdConversion(bEnabled); | 1251 m_pAltCS->EnableStdConversion(bEnabled); |
| 1252 } | 1252 } |
| 1253 } | 1253 } |
| OLD | NEW |