Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Unified Diff: core/src/fxge/agg/src/fx_agg_driver.cpp

Issue 1567343002: Switch most min/max macros to std::min/max. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: actually compile Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxcrt/xml_int.h ('k') | core/src/fxge/android/fpf_skiafont.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/agg/src/fx_agg_driver.cpp
diff --git a/core/src/fxge/agg/src/fx_agg_driver.cpp b/core/src/fxge/agg/src/fx_agg_driver.cpp
index ed2e8e41f0aa61bffc4342d87a2a226fd2c7c7d4..6828531cbad04673285a263b8fdeee5428c889a7 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,
« no previous file with comments | « core/src/fxcrt/xml_int.h ('k') | core/src/fxge/android/fpf_skiafont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698