diff options
author | thestig <thestig@chromium.org> | 2016-11-11 12:06:47 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-11 12:06:47 -0800 |
commit | dc40c40f40ed2415605da32f688091a57f53c9e6 (patch) | |
tree | 9fbd02dffbf9028c782fa28c707f2a819a8582c4 /core/fpdfapi/page | |
parent | 5937d0d03793caf73c8bb795ac06684596790e82 (diff) | |
download | pdfium-dc40c40f40ed2415605da32f688091a57f53c9e6.tar.xz |
Relax colorspace checks in CPDF_DIBSource::CreateDecoder().chromium/2917
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
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r-- | core/fpdfapi/page/fpdf_page_colors.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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, |