Use pdfium::clamp() in CFX_SkiaDeviceDriver::StartDIBits().

Change-Id: I4df4c30b0146353db2d07151b762057bc878dbf9
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/66071
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index f0c550c..0b0b900 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -34,6 +34,7 @@
 #include "core/fxge/text_char_pos.h"
 #include "third_party/base/logging.h"
 #include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/core/SkClipOp.h"
 #include "third_party/skia/include/core/SkColorPriv.h"
@@ -2502,8 +2503,8 @@
           SkPoint src = {x + 0.5f, y + 0.5f};
           inv.mapPoints(&src, 1);
           // TODO(caryclark) Why does the matrix map require clamping?
-          src.fX = std::max(0.5f, std::min(src.fX, width - 0.5f));
-          src.fY = std::max(0.5f, std::min(src.fY, height - 0.5f));
+          src.fX = pdfium::clamp(src.fX, 0.5f, width - 0.5f);
+          src.fY = pdfium::clamp(src.fY, 0.5f, height - 0.5f);
           m_pBitmap->SetPixel(x, y, skBitmap.getColor(src.fX, src.fY));
         }
       }