summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-03-17 15:14:19 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-17 22:54:26 +0000
commit85f019a8e7d33cbba368a6c6b75fd091269e14a1 (patch)
tree8dcf6fcd98309a48ebbd9e46cc8c0d23a57c0965 /core/fpdfapi/font
parent240fe6d79f234896a966ddce0b9a125776dc9171 (diff)
downloadpdfium-85f019a8e7d33cbba368a6c6b75fd091269e14a1.tar.xz
Add pdfium::clamp() as a placeholder for std::clamp().chromium/3046
Ue it to fix a typo as well. BUG=pdfium:634 Change-Id: I2d686242ffb841aedc2fae6a3cf7a00bea667404 Reviewed-on: https://pdfium-review.googlesource.com/3113 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/font')
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index 4c378f7598..217a6eaf2e 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -21,6 +21,7 @@
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "third_party/base/numerics/safe_math.h"
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
namespace {
@@ -450,10 +451,10 @@ FX_RECT CPDF_CIDFont::GetCharBBox(uint32_t charcode) {
if (!err) {
FXFT_BBox cbox;
FXFT_Glyph_Get_CBox(glyph, FXFT_GLYPH_BBOX_PIXELS, &cbox);
- cbox.xMin = std::min(std::max(cbox.xMin, kMinCBox), kMaxCBox);
- cbox.xMax = std::min(std::max(cbox.xMax, kMinCBox), kMaxCBox);
- cbox.yMin = std::min(std::max(cbox.yMin, kMinCBox), kMaxCBox);
- cbox.yMax = std::min(std::max(cbox.yMax, kMinCBox), kMaxCBox);
+ cbox.xMin = pdfium::clamp(cbox.xMin, kMinCBox, kMaxCBox);
+ cbox.xMax = pdfium::clamp(cbox.xMax, kMinCBox, kMaxCBox);
+ cbox.yMin = pdfium::clamp(cbox.yMin, kMinCBox, kMaxCBox);
+ cbox.yMax = pdfium::clamp(cbox.yMax, kMinCBox, kMaxCBox);
int pixel_size_x = ((FXFT_Face)face)->size->metrics.x_ppem;
int pixel_size_y = ((FXFT_Face)face)->size->metrics.y_ppem;
if (pixel_size_x == 0 || pixel_size_y == 0) {