summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-11-11 12:06:47 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-11 12:06:47 -0800
commitdc40c40f40ed2415605da32f688091a57f53c9e6 (patch)
tree9fbd02dffbf9028c782fa28c707f2a819a8582c4 /core/fpdfapi/page
parent5937d0d03793caf73c8bb795ac06684596790e82 (diff)
downloadpdfium-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.cpp12
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,