33 std::set<
const CPDF_Object*>* pVisited) {
34 if (pArray->size() < 4) {
45 pDocPageData->GetColorSpaceGuarded(pBaseObj.Get(),
nullptr, pVisited);
52 Family family = m_pBaseCS->GetFamily();
57 uint32_t base_component_count = m_pBaseCS->ComponentCount();
58 DCHECK(base_component_count);
59 component_min_max_ = DataVector<IndexedColorMinMax>(base_component_count);
61 for (uint32_t i = 0; i < component_min_max_.size(); i++) {
63 m_pBaseCS->GetDefaultValue(i, &defvalue, &comp.min, &comp.max);
68 max_index_ = pArray->GetIntegerAt(2);
69 if (max_index_ < 0 || max_index_ > 255) {
78 if (
const CPDF_String* str_obj = pTableObj->AsString()) {
80 pdfium::span<
const uint8_t> str_span = str_data.unsigned_span();
81 lookup_table_ = DataVector<uint8_t>(str_span.begin(), str_span.end());
82 }
else if (
const CPDF_Stream* stream_obj = pTableObj->AsStream()) {
84 pdfium::MakeRetain<CPDF_StreamAcc>(
pdfium::WrapRetain(stream_obj));
85 acc->LoadAllDataFiltered();
86 pdfium::span<
const uint8_t> str_span = acc->GetSpan();
87 lookup_table_ = DataVector<uint8_t>(str_span.begin(), str_span.end());
93 pdfium::span<
const float> pBuf)
const {
94 int32_t index =
static_cast<int32_t>(pBuf[0]);
95 if (index < 0 || index > max_index_) {
99 DCHECK(!component_min_max_.empty());
100 DCHECK_EQ(component_min_max_.size(), m_pBaseCS->ComponentCount());
102 FX_SAFE_SIZE_T length = index;
104 length *= component_min_max_.size();
105 if (!length.IsValid() || length.ValueOrDie() > lookup_table_.size()) {
109 DataVector<
float> comps(component_min_max_.size());
110 for (uint32_t i = 0; i < component_min_max_.size(); ++i) {
114 comp.max * lookup_table_[index * component_min_max_.size() + i] / 255;
116 return m_pBaseCS->GetRGB(comps);
static CPDF_DocPageData * FromDocument(const CPDF_Document *pDoc)