From dc40c40f40ed2415605da32f688091a57f53c9e6 Mon Sep 17 00:00:00 2001 From: thestig Date: Fri, 11 Nov 2016 12:06:47 -0800 Subject: Relax colorspace checks in CPDF_DIBSource::CreateDecoder(). Previously the log just made sure the colorspace and the image have exact matches for the number of colorspace components. Now, for some colorspace types, check the type and make sure the number of components meets or exceeds what is required by the spec. Also do some refactoring. BUG=chromium:650230 Review-Url: https://codereview.chromium.org/2486123002 --- core/fpdfapi/page/fpdf_page_colors.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'core/fpdfapi/page/fpdf_page_colors.cpp') diff --git a/core/fpdfapi/page/fpdf_page_colors.cpp b/core/fpdfapi/page/fpdf_page_colors.cpp index 455233abb5..69129e4f2b 100644 --- a/core/fpdfapi/page/fpdf_page_colors.cpp +++ b/core/fpdfapi/page/fpdf_page_colors.cpp @@ -21,6 +21,12 @@ namespace { +FX_FLOAT NormalizeChannel(FX_FLOAT fVal) { + return std::min(std::max(fVal, 0.0f), 1.0f); +} + +} // namespace + uint32_t ComponentsForFamily(int family) { if (family == PDFCS_DEVICERGB) return 3; @@ -30,12 +36,6 @@ uint32_t ComponentsForFamily(int family) { return 4; } -FX_FLOAT NormalizeChannel(FX_FLOAT fVal) { - return std::min(std::max(fVal, 0.0f), 1.0f); -} - -} // namespace - void sRGB_to_AdobeCMYK(FX_FLOAT R, FX_FLOAT G, FX_FLOAT B, -- cgit v1.2.3