summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp
index c2156a1555..f6009674c5 100644
--- a/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -1399,8 +1399,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
m_pCompData[j].m_DecodeStep * component_value) *
255.0f +
0.5f);
- extracted_components[j] =
- color_value > 255 ? 255 : (color_value < 0 ? 0 : color_value);
+ extracted_components[j] = pdfium::clamp(color_value, 0, 255);
}
m_pColorSpace->TranslateImageLine(color, extracted_components, 1, 0,
0, bTransMask);