diff options
Diffstat (limited to 'core/fpdfapi/page/cpdf_allstates.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_allstates.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/core/fpdfapi/page/cpdf_allstates.cpp b/core/fpdfapi/page/cpdf_allstates.cpp index a30696e8b7..c67d3152c0 100644 --- a/core/fpdfapi/page/cpdf_allstates.cpp +++ b/core/fpdfapi/page/cpdf_allstates.cpp @@ -14,14 +14,7 @@ #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fxge/cfx_graphstatedata.h" - -namespace { - -float ClipFloat(float f) { - return std::max(0.0f, std::min(1.0f, f)); -} - -} // namespace +#include "third_party/base/stl_util.h" CPDF_AllStates::CPDF_AllStates() : m_TextLeading(0), m_TextRise(0), m_TextHorzScale(1.0f) {} @@ -117,10 +110,12 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, } break; case FXBSTR_ID('C', 'A', 0, 0): - m_GeneralState.SetStrokeAlpha(ClipFloat(pObject->GetNumber())); + m_GeneralState.SetStrokeAlpha( + pdfium::clamp(pObject->GetNumber(), 0.0f, 1.0f)); break; case FXBSTR_ID('c', 'a', 0, 0): - m_GeneralState.SetFillAlpha(ClipFloat(pObject->GetNumber())); + m_GeneralState.SetFillAlpha( + pdfium::clamp(pObject->GetNumber(), 0.0f, 1.0f)); break; case FXBSTR_ID('O', 'P', 0, 0): m_GeneralState.SetStrokeOP(!!pObject->GetInteger()); |