34 const CPDF_Array* pArray,
35 std::set<
const CPDF_Object*>* pVisited) {
36 if (pArray->size() < 4)
45 pDocPageData->GetColorSpaceGuarded(pBaseObj.Get(),
nullptr, pVisited);
51 Family family = m_pBaseCS->GetFamily();
55 m_nBaseComponents = m_pBaseCS->CountComponents();
56 DCHECK(m_nBaseComponents);
57 m_pCompMinMax = DataVector<
float>(Fx2DSizeOrDie(m_nBaseComponents, 2));
59 for (uint32_t i = 0; i < m_nBaseComponents; i++) {
60 m_pBaseCS->GetDefaultValue(i, &defvalue, &m_pCompMinMax[i * 2],
61 &m_pCompMinMax[i * 2 + 1]);
62 m_pCompMinMax[i * 2 + 1] -= m_pCompMinMax[i * 2];
64 m_MaxIndex = pArray->GetIntegerAt(2);
70 if (
const CPDF_String* pString = pTableObj->AsString()) {
71 m_Table = pString->GetString();
72 }
else if (
const CPDF_Stream* pStream = pTableObj->AsStream()) {
73 auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pdfium::WrapRetain(pStream));
74 pAcc->LoadAllDataFiltered();
75 m_Table = ByteStringView(pAcc->GetSpan());
80bool CPDF_IndexedCS::
GetRGB(pdfium::span<
const float> pBuf,
84 int32_t index =
static_cast<int32_t>(pBuf[0]);
85 if (index < 0 || index > m_MaxIndex)
88 DCHECK(m_nBaseComponents);
89 DCHECK_EQ(m_nBaseComponents, m_pBaseCS->CountComponents());
91 FX_SAFE_SIZE_T length = index;
93 length *= m_nBaseComponents;
94 if (!length.IsValid() || length.ValueOrDie() > m_Table.GetLength()) {
101 std::vector<
float> comps(m_nBaseComponents);
102 const uint8_t* pTable = m_Table.raw_str();
103 for (uint32_t i = 0; i < m_nBaseComponents; ++i) {
105 m_pCompMinMax[i * 2] +
106 m_pCompMinMax[i * 2 + 1] * pTable[index * m_nBaseComponents + i] / 255;
108 return m_pBaseCS->GetRGB(comps, R, G, B);
static CPDF_DocPageData * FromDocument(const CPDF_Document *pDoc)