diff options
author | Lei Zhang <thestig@chromium.org> | 2016-01-11 11:59:17 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2016-01-11 11:59:17 -0800 |
commit | 375a86403b7fa8d17d7b142c270e2d8e33bb924f (patch) | |
tree | 1db1ffddb2bbbcd429cd1d7954b1949bfa54e1ab /xfa/src/fdp | |
parent | 492961df3011ccc25646eae12ac6e6dcfe7f26da (diff) | |
download | pdfium-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 'xfa/src/fdp')
-rw-r--r-- | xfa/src/fdp/src/css/fde_csscache.cpp | 7 | ||||
-rw-r--r-- | xfa/src/fdp/src/fde/fde_gedevice.cpp | 4 | ||||
-rw-r--r-- | xfa/src/fdp/src/tto/fde_textout.cpp | 10 | ||||
-rw-r--r-- | xfa/src/fdp/src/xml/fde_xml.cpp | 6 |
4 files changed, 18 insertions, 9 deletions
diff --git a/xfa/src/fdp/src/css/fde_csscache.cpp b/xfa/src/fdp/src/css/fde_csscache.cpp index fd33019e18..3d3b040a87 100644 --- a/xfa/src/fdp/src/css/fde_csscache.cpp +++ b/xfa/src/fdp/src/css/fde_csscache.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "fde_csscache.h"
_FDE_CSSCACHEITEM::_FDE_CSSCACHEITEM(IFDE_CSSStyleSheet* p)
@@ -34,8 +36,9 @@ void CFDE_CSSStyleSheetCache::AddStyleSheet(const CFX_ByteStringC& szKey, IFDE_CSSStyleSheet* pStyleSheet) {
FXSYS_assert(pStyleSheet != NULL);
if (m_pFixedStore == NULL) {
- m_pFixedStore = FX_CreateAllocator(
- FX_ALLOCTYPE_Fixed, FX_MAX(10, m_iMaxItems), sizeof(FDE_CSSCACHEITEM));
+ m_pFixedStore =
+ FX_CreateAllocator(FX_ALLOCTYPE_Fixed, std::max(10, m_iMaxItems),
+ sizeof(FDE_CSSCACHEITEM));
FXSYS_assert(m_pFixedStore != NULL);
}
auto it = m_Stylesheets.find(szKey);
diff --git a/xfa/src/fdp/src/fde/fde_gedevice.cpp b/xfa/src/fdp/src/fde/fde_gedevice.cpp index 08f05e74bb..f4e46d0d81 100644 --- a/xfa/src/fdp/src/fde/fde_gedevice.cpp +++ b/xfa/src/fdp/src/fde/fde_gedevice.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "fde_gedevice.h"
#include "fde_geobject.h"
@@ -541,7 +543,7 @@ FX_BOOL CFDE_FxgeDevice::FillLinearGradientPath(IFDE_Brush* pBrush, FX_FLOAT fLength = fDiagonal.Length();
FX_FLOAT fTotalX = fLength / FXSYS_cos(fTheta);
FX_FLOAT fTotalY = fLength / FXSYS_cos(FX_PI / 2 - fTheta);
- FX_FLOAT fSteps = FX_MAX(fTotalX, fTotalY);
+ FX_FLOAT fSteps = std::max(fTotalX, fTotalY);
FX_FLOAT dx = fTotalX / fSteps;
FX_FLOAT dy = fTotalY / fSteps;
FX_ARGB cr0, cr1;
diff --git a/xfa/src/fdp/src/tto/fde_textout.cpp b/xfa/src/fdp/src/tto/fde_textout.cpp index b9a8e80107..90f21f15bb 100644 --- a/xfa/src/fdp/src/tto/fde_textout.cpp +++ b/xfa/src/fdp/src/tto/fde_textout.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "fde_textout.h"
IFDE_TextOut* IFDE_TextOut::Create() {
@@ -270,11 +272,11 @@ void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr, rect.top += fStartPos;
rect.left += fInc;
rect.width = fHeight;
- rect.height = FX_MIN(fWidth, rect.Height());
+ rect.height = std::min(fWidth, rect.Height());
} else {
rect.left += fStartPos;
rect.top += fInc;
- rect.width = FX_MIN(fWidth, rect.Width());
+ rect.width = std::min(fWidth, rect.Width());
rect.height = fHeight;
if (m_dwStyles & FDE_TTOSTYLE_LastLineHeight) {
rect.height -= m_fLineSpace - m_fFontSize;
@@ -313,7 +315,7 @@ FX_BOOL CFDE_TextOut::RetrieveLineWidth(FX_DWORD dwBreakStatus, for (int32_t i = 0; i < iCount; i++) {
const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i);
fLineWidth += (FX_FLOAT)pPiece->m_iWidth / 20000.0f;
- fStartPos = FX_MIN(fStartPos, (FX_FLOAT)pPiece->m_iStartPos / 20000.0f);
+ fStartPos = std::min(fStartPos, (FX_FLOAT)pPiece->m_iStartPos / 20000.0f);
}
m_pTxtBreak->ClearBreakPieces();
if (dwBreakStatus == FX_TXTBREAK_ParagraphBreak) {
@@ -322,7 +324,7 @@ FX_BOOL CFDE_TextOut::RetrieveLineWidth(FX_DWORD dwBreakStatus, if (!bLineWrap && dwBreakStatus == FX_TXTBREAK_LineBreak) {
fWidth += fLineWidth;
} else {
- fWidth = FX_MAX(fWidth, fLineWidth);
+ fWidth = std::max(fWidth, fLineWidth);
fHeight += fLineStep;
}
m_iTotalLines++;
diff --git a/xfa/src/fdp/src/xml/fde_xml.cpp b/xfa/src/fdp/src/xml/fde_xml.cpp index aa217227c4..8725cb7655 100644 --- a/xfa/src/fdp/src/xml/fde_xml.cpp +++ b/xfa/src/fdp/src/xml/fde_xml.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "fde_xml.h"
#ifdef __cplusplus
@@ -1484,7 +1486,7 @@ void CFDE_XMLSyntaxParser::Init(IFX_Stream* pStream, int32_t iStreamLength = pStream->GetLength();
FXSYS_assert(iStreamLength > 0);
m_pStream = pStream;
- m_iXMLPlaneSize = FX_MIN(iXMLPlaneSize, iStreamLength);
+ m_iXMLPlaneSize = std::min(iXMLPlaneSize, iStreamLength);
uint8_t bom[4];
m_iCurrentPos = m_pStream->GetBOM(bom);
FXSYS_assert(m_pBuffer == NULL);
@@ -2002,7 +2004,7 @@ void CFDE_XMLSyntaxParser::Init(IFX_Stream* pStream, int32_t iStreamLength = pStream->GetLength();
FXSYS_assert(iStreamLength > 0);
m_pStream = pStream;
- m_iXMLPlaneSize = FX_MIN(iXMLPlaneSize, iStreamLength);
+ m_iXMLPlaneSize = std::min(iXMLPlaneSize, iStreamLength);
m_iTextDataSize = iTextDataSize;
uint8_t bom[4];
m_iCurrentPos = m_pStream->GetBOM(bom);
|