summaryrefslogtreecommitdiff
path: root/core/src/fxge
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-01-11 11:59:17 -0800
committerLei Zhang <thestig@chromium.org>2016-01-11 11:59:17 -0800
commit375a86403b7fa8d17d7b142c270e2d8e33bb924f (patch)
tree1db1ffddb2bbbcd429cd1d7954b1949bfa54e1ab /core/src/fxge
parent492961df3011ccc25646eae12ac6e6dcfe7f26da (diff)
downloadpdfium-375a86403b7fa8d17d7b142c270e2d8e33bb924f.tar.xz
Merge to XFA: Switch most min/max macros to std::min/max.
Fix lint errors along the way. R=tsepez@chromium.org TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1567343002 . (cherry picked from commit 9adfbb0920a258e916003b1ee9515e97879db82a) Review URL: https://codereview.chromium.org/1577503002 .
Diffstat (limited to 'core/src/fxge')
-rw-r--r--core/src/fxge/agg/src/fx_agg_driver.cpp34
-rw-r--r--core/src/fxge/android/fpf_skiafont.cpp7
2 files changed, 22 insertions, 19 deletions
diff --git a/core/src/fxge/agg/src/fx_agg_driver.cpp b/core/src/fxge/agg/src/fx_agg_driver.cpp
index ed2e8e41f0..6828531cba 100644
--- a/core/src/fxge/agg/src/fx_agg_driver.cpp
+++ b/core/src/fxge/agg/src/fx_agg_driver.cpp
@@ -6,6 +6,8 @@
#include "core/src/fxge/agg/include/fx_agg_driver.h"
+#include <algorithm>
+
#include "core/include/fxcodec/fx_codec.h"
#include "core/include/fxge/fx_ge.h"
#include "core/src/fxge/dib/dib_int.h"
@@ -19,20 +21,15 @@
#include "third_party/agg23/agg_renderer_scanline.h"
#include "third_party/agg23/agg_scanline_u.h"
-void _HardClip(FX_FLOAT& x, FX_FLOAT& y) {
- if (x > 50000) {
- x = 50000;
- }
- if (x < -50000) {
- x = -50000;
- }
- if (y > 50000) {
- y = 50000;
- }
- if (y < -50000) {
- y = -50000;
- }
+namespace {
+
+void HardClip(FX_FLOAT& x, FX_FLOAT& y) {
+ x = std::max(std::min(x, 50000.0f), -50000.0f);
+ y = std::max(std::min(y, 50000.0f), -50000.0f);
}
+
+} // namespace
+
void CAgg_PathData::BuildPath(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device) {
int nPoints = pPathData->GetPointCount();
@@ -42,7 +39,7 @@ void CAgg_PathData::BuildPath(const CFX_PathData* pPathData,
if (pObject2Device) {
pObject2Device->Transform(x, y);
}
- _HardClip(x, y);
+ HardClip(x, y);
int point_type = pPoints[i].m_Flag & FXPT_TYPE;
if (point_type == FXPT_MOVETO) {
m_PathData.move_to(x, y);
@@ -73,6 +70,7 @@ void CAgg_PathData::BuildPath(const CFX_PathData* pPathData,
}
}
namespace agg {
+
template <class BaseRenderer>
class renderer_scanline_aa_offset {
public:
@@ -109,7 +107,9 @@ class renderer_scanline_aa_offset {
color_type m_color;
unsigned m_left, m_top;
};
-}
+
+} // namespace agg
+
static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer,
agg::path_storage& path_data,
const CFX_Matrix* pObject2Device,
@@ -1257,8 +1257,8 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
}
CFX_Matrix matrix1, matrix2;
if (pObject2Device) {
- matrix1.a =
- FX_MAX(FXSYS_fabs(pObject2Device->a), FXSYS_fabs(pObject2Device->b));
+ matrix1.a = std::max(FXSYS_fabs(pObject2Device->a),
+ FXSYS_fabs(pObject2Device->b));
matrix1.d = matrix1.a;
matrix2.Set(pObject2Device->a / matrix1.a, pObject2Device->b / matrix1.a,
pObject2Device->c / matrix1.d, pObject2Device->d / matrix1.d,
diff --git a/core/src/fxge/android/fpf_skiafont.cpp b/core/src/fxge/android/fpf_skiafont.cpp
index ba202acc92..222b28ee8f 100644
--- a/core/src/fxge/android/fpf_skiafont.cpp
+++ b/core/src/fxge/android/fpf_skiafont.cpp
@@ -5,6 +5,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "fx_fpf.h"
+
+#include <algorithm>
+
#if _FX_OS_ == _FX_ANDROID_
#include "fpf_skiafont.h"
#include "fpf_skiafontmgr.h"
@@ -106,8 +109,8 @@ FX_BOOL CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) {
rtBBox.right = FPF_EM_ADJUST(x_ppem, cbox.xMax);
rtBBox.top = FPF_EM_ADJUST(y_ppem, cbox.yMax);
rtBBox.bottom = FPF_EM_ADJUST(y_ppem, cbox.yMin);
- rtBBox.top = FX_MIN(rtBBox.top, GetAscent());
- rtBBox.bottom = FX_MAX(rtBBox.bottom, GetDescent());
+ rtBBox.top = std::min(rtBBox.top, GetAscent());
+ rtBBox.bottom = std::max(rtBBox.bottom, GetDescent());
FXFT_Done_Glyph(glyph);
return FXFT_Set_Pixel_Sizes(m_Face, 0, 64) == 0;
}