summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--constants/transparency.h1
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp12
2 files changed, 8 insertions, 5 deletions
diff --git a/constants/transparency.h b/constants/transparency.h
index 22a89c33c4..6532868178 100644
--- a/constants/transparency.h
+++ b/constants/transparency.h
@@ -46,6 +46,7 @@ constexpr char kTR[] = "TR";
constexpr char kGroupSubType[] = "S";
constexpr char kTransparency[] = "Transparency";
+constexpr char kCS[] = "CS";
constexpr char kI[] = "I";
} // namespace transparency
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index d63d321b9f..af976903be 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -2646,17 +2646,19 @@ FX_ARGB CPDF_RenderStatus::GetBackColor(const CPDF_Dictionary* pSMaskDict,
const CPDF_Object* pCSObj = nullptr;
const CPDF_Dictionary* pGroup =
pGroupDict ? pGroupDict->GetDictFor("Group") : nullptr;
- if (pGroup) {
- // TODO(thestig): Check if "CS" is from PDF spec 1.7, table 13.
- pCSObj = pGroup->GetDirectObjectFor("CS");
- }
+ if (pGroup)
+ pCSObj = pGroup->GetDirectObjectFor(pdfium::transparency::kCS);
const CPDF_ColorSpace* pCS =
m_pContext->GetDocument()->LoadColorSpace(pCSObj);
if (!pCS)
return kDefaultColor;
+ int family = pCS->GetFamily();
+ if (family == PDFCS_LAB || family == PDFCS_ICCBASED || pCS->IsSpecial())
+ return kDefaultColor;
+
// Store Color Space Family to use in CPDF_RenderStatus::Initialize().
- *pCSFamily = pCS->GetFamily();
+ *pCSFamily = family;
uint32_t comps = std::max(8u, pCS->CountComponents());
std::vector<float> floats(comps);