summaryrefslogtreecommitdiff
path: root/xfa/fgas/layout
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-14 14:43:42 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-14 19:05:58 +0000
commit05df075154a832fcb476e1dfcfb865722d0ea898 (patch)
treeb8b771b62adae74d5d5ee561db75d10de3a848bf /xfa/fgas/layout
parent6b94f01d1c8ad386d497428c7397b1a99614aeba (diff)
downloadpdfium-05df075154a832fcb476e1dfcfb865722d0ea898.tar.xz
Replace FX_FLOAT with underlying float type.
Change-Id: I158b7d80b0ec28b742a9f2d5a96f3dde7fb3ab56 Reviewed-on: https://pdfium-review.googlesource.com/3031 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fgas/layout')
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp28
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h16
-rw-r--r--xfa/fgas/layout/fgas_textbreak.cpp48
-rw-r--r--xfa/fgas/layout/fgas_textbreak.h14
4 files changed, 53 insertions, 53 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index 1e0cc9c25e..37822140c3 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -43,7 +43,7 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwLayoutStyles)
CFX_RTFBreak::~CFX_RTFBreak() {}
-void CFX_RTFBreak::SetLineBoundary(FX_FLOAT fLineStart, FX_FLOAT fLineEnd) {
+void CFX_RTFBreak::SetLineBoundary(float fLineStart, float fLineEnd) {
if (fLineStart > fLineEnd)
return;
@@ -53,7 +53,7 @@ void CFX_RTFBreak::SetLineBoundary(FX_FLOAT fLineStart, FX_FLOAT fLineEnd) {
m_pCurLine->m_iStart = std::max(m_pCurLine->m_iStart, m_iBoundaryStart);
}
-void CFX_RTFBreak::SetLineStartPos(FX_FLOAT fLinePos) {
+void CFX_RTFBreak::SetLineStartPos(float fLinePos) {
int32_t iLinePos = FXSYS_round(fLinePos * 20000.0f);
iLinePos = std::min(iLinePos, m_iBoundaryEnd);
iLinePos = std::max(iLinePos, m_iBoundaryStart);
@@ -69,7 +69,7 @@ void CFX_RTFBreak::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) {
FontChanged();
}
-void CFX_RTFBreak::SetFontSize(FX_FLOAT fFontSize) {
+void CFX_RTFBreak::SetFontSize(float fFontSize) {
int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
if (m_iFontSize == iFontSize)
return;
@@ -92,11 +92,11 @@ void CFX_RTFBreak::FontChanged() {
m_iDefChar *= m_iFontSize;
}
-void CFX_RTFBreak::SetTabWidth(FX_FLOAT fTabWidth) {
+void CFX_RTFBreak::SetTabWidth(float fTabWidth) {
m_iTabWidth = FXSYS_round(fTabWidth * 20000.0f);
}
-void CFX_RTFBreak::AddPositionedTab(FX_FLOAT fTabPos) {
+void CFX_RTFBreak::AddPositionedTab(float fTabPos) {
int32_t iTabPos = std::min(FXSYS_round(fTabPos * 20000.0f) + m_iBoundaryStart,
m_iBoundaryEnd);
auto it = std::lower_bound(m_PositionedTabs.begin(), m_PositionedTabs.end(),
@@ -106,7 +106,7 @@ void CFX_RTFBreak::AddPositionedTab(FX_FLOAT fTabPos) {
m_PositionedTabs.insert(it, iTabPos);
}
-void CFX_RTFBreak::SetLineBreakTolerance(FX_FLOAT fTolerance) {
+void CFX_RTFBreak::SetLineBreakTolerance(float fTolerance) {
m_iTolerance = FXSYS_round(fTolerance * 20000.0f);
}
@@ -130,7 +130,7 @@ void CFX_RTFBreak::SetVerticalScale(int32_t iScale) {
m_iVerticalScale = iScale;
}
-void CFX_RTFBreak::SetCharSpace(FX_FLOAT fCharSpace) {
+void CFX_RTFBreak::SetCharSpace(float fCharSpace) {
m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f);
}
@@ -834,23 +834,23 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
CFX_RetainPtr<CFGAS_GEFont> pFont = pText->pFont;
CFX_RectF rtText(*pText->pRect);
bool bRTLPiece = FX_IsOdd(pText->iBidiLevel);
- FX_FLOAT fFontSize = pText->fFontSize;
+ float fFontSize = pText->fFontSize;
int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
int32_t iAscent = pFont->GetAscent();
int32_t iDescent = pFont->GetDescent();
int32_t iMaxHeight = iAscent - iDescent;
- FX_FLOAT fFontHeight = fFontSize;
- FX_FLOAT fAscent = fFontHeight * static_cast<FX_FLOAT>(iAscent) /
- static_cast<FX_FLOAT>(iMaxHeight);
+ float fFontHeight = fFontSize;
+ float fAscent = fFontHeight * static_cast<float>(iAscent) /
+ static_cast<float>(iMaxHeight);
wchar_t wPrev = 0xFEFF;
wchar_t wNext;
- FX_FLOAT fX = rtText.left;
+ float fX = rtText.left;
int32_t iHorScale = pText->iHorizontalScale;
int32_t iVerScale = pText->iVerticalScale;
if (bRTLPiece)
fX = rtText.right();
- FX_FLOAT fY = rtText.top + fAscent;
+ float fY = rtText.top + fAscent;
int32_t iCount = 0;
for (int32_t i = 0; i < pText->iLength; ++i) {
wchar_t wch = pText->pStr[i];
@@ -900,7 +900,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
pCharPos->m_FontCharWidth = iCharWidth;
}
- FX_FLOAT fCharWidth = fFontSize * iCharWidth / 1000.0f;
+ float fCharWidth = fFontSize * iCharWidth / 1000.0f;
if (bRTLPiece && dwCharType != FX_CHARTYPE_Combination)
fX -= fCharWidth;
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h
index 339d2f4bcd..978634d1c8 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -37,7 +37,7 @@ struct FX_RTFTEXTOBJ {
CFX_RetainPtr<CFGAS_GEFont> pFont;
const CFX_RectF* pRect;
wchar_t wLineBreakChar;
- FX_FLOAT fFontSize;
+ float fFontSize;
int32_t iLength;
int32_t iBidiLevel;
int32_t iHorizontalScale;
@@ -49,19 +49,19 @@ class CFX_RTFBreak {
explicit CFX_RTFBreak(uint32_t dwLayoutStyles);
~CFX_RTFBreak();
- void SetLineBoundary(FX_FLOAT fLineStart, FX_FLOAT fLineEnd);
- void SetLineStartPos(FX_FLOAT fLinePos);
+ void SetLineBoundary(float fLineStart, float fLineEnd);
+ void SetLineStartPos(float fLinePos);
void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
- void SetFontSize(FX_FLOAT fFontSize);
- void SetTabWidth(FX_FLOAT fTabWidth);
- void SetLineBreakTolerance(FX_FLOAT fTolerance);
+ void SetFontSize(float fFontSize);
+ void SetTabWidth(float fTabWidth);
+ void SetLineBreakTolerance(float fTolerance);
void SetHorizontalScale(int32_t iScale);
void SetVerticalScale(int32_t iScale);
- void SetCharSpace(FX_FLOAT fCharSpace);
+ void SetCharSpace(float fCharSpace);
void SetAlignment(CFX_RTFLineAlignment align) { m_iAlignment = align; }
void SetUserData(const CFX_RetainPtr<CFX_Retainable>& pUserData);
- void AddPositionedTab(FX_FLOAT fTabPos);
+ void AddPositionedTab(float fTabPos);
CFX_BreakType EndBreak(CFX_BreakType dwStatus);
int32_t CountBreakPieces() const;
diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp
index eabe381621..8bba780382 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -67,7 +67,7 @@ CFX_TxtBreak::CFX_TxtBreak()
CFX_TxtBreak::~CFX_TxtBreak() {}
-void CFX_TxtBreak::SetLineWidth(FX_FLOAT fLineWidth) {
+void CFX_TxtBreak::SetLineWidth(float fLineWidth) {
m_iLineWidth = FXSYS_round(fLineWidth * 20000.0f);
ASSERT(m_iLineWidth >= 20000);
}
@@ -88,7 +88,7 @@ void CFX_TxtBreak::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) {
FontChanged();
}
-void CFX_TxtBreak::SetFontSize(FX_FLOAT fFontSize) {
+void CFX_TxtBreak::SetFontSize(float fFontSize) {
int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
if (m_iFontSize == iFontSize)
return;
@@ -107,7 +107,7 @@ void CFX_TxtBreak::FontChanged() {
m_iDefChar *= m_iFontSize;
}
-void CFX_TxtBreak::SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant) {
+void CFX_TxtBreak::SetTabWidth(float fTabWidth, bool bEquidistant) {
m_iTabWidth = std::max(FXSYS_round(fTabWidth * 20000.0f), kMinimumTabWidth);
m_bEquidistant = bEquidistant;
}
@@ -131,7 +131,7 @@ void CFX_TxtBreak::SetParagraphBreakChar(wchar_t wch) {
m_wParagBreakChar = wch;
}
-void CFX_TxtBreak::SetLineBreakTolerance(FX_FLOAT fTolerance) {
+void CFX_TxtBreak::SetLineBreakTolerance(float fTolerance) {
m_iTolerance = FXSYS_round(fTolerance * 20000.0f);
}
@@ -147,7 +147,7 @@ void CFX_TxtBreak::ResetContextCharStyles() {
m_dwContextCharStyles |= (m_iArabicContext << 8);
}
-void CFX_TxtBreak::SetCombWidth(FX_FLOAT fCombWidth) {
+void CFX_TxtBreak::SetCombWidth(float fCombWidth) {
m_iCombWidth = FXSYS_round(fCombWidth * 20000.0f);
}
@@ -171,7 +171,7 @@ void CFX_TxtBreak::SetHorizontalScale(int32_t iScale) {
m_iHorScale = iScale;
}
-void CFX_TxtBreak::SetCharSpace(FX_FLOAT fCharSpace) {
+void CFX_TxtBreak::SetCharSpace(float fCharSpace) {
m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f);
}
@@ -841,22 +841,22 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
uint32_t dwStyles = pTxtRun->dwStyles;
CFX_RectF rtText(*pTxtRun->pRect);
bool bRTLPiece = (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0;
- FX_FLOAT fFontSize = pTxtRun->fFontSize;
+ float fFontSize = pTxtRun->fFontSize;
int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
int32_t iAscent = pFont->GetAscent();
int32_t iDescent = pFont->GetDescent();
int32_t iMaxHeight = iAscent - iDescent;
- FX_FLOAT fFontHeight = fFontSize;
- FX_FLOAT fAscent = fFontHeight * (FX_FLOAT)iAscent / (FX_FLOAT)iMaxHeight;
- FX_FLOAT fX = rtText.left;
- FX_FLOAT fY;
- FX_FLOAT fCharWidth;
- FX_FLOAT fCharHeight;
+ float fFontHeight = fFontSize;
+ float fAscent = fFontHeight * (float)iAscent / (float)iMaxHeight;
+ float fX = rtText.left;
+ float fY;
+ float fCharWidth;
+ float fCharHeight;
int32_t iHorScale = pTxtRun->iHorizontalScale;
int32_t iVerScale = pTxtRun->iVerticalScale;
bool bSkipSpace = pTxtRun->bSkipSpace;
FX_FORMCHAR formChars[3];
- FX_FLOAT fYBase;
+ float fYBase;
if (bRTLPiece)
fX = rtText.right();
@@ -1036,7 +1036,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
if ((dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0) {
int32_t iFormWidth = iCharWidth;
pFont->GetCharWidth(wForm, iFormWidth, false);
- FX_FLOAT fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f;
+ float fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f;
pCharPos->m_Origin.x += fOffset;
}
@@ -1045,7 +1045,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
if (pFont->GetCharBBox(wForm, &rtBBox, false)) {
pCharPos->m_Origin.y =
fYBase + fFontSize -
- fFontSize * (FX_FLOAT)rtBBox.height / (FX_FLOAT)iMaxHeight;
+ fFontSize * (float)rtBBox.height / (float)iMaxHeight;
}
if (wForm == wch && wLast != 0xFEFF) {
uint32_t dwLastProps = FX_GetUnicodeProperties(wLast);
@@ -1102,9 +1102,9 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
int32_t* pWidths = pTxtRun->pWidths;
int32_t iLength = pTxtRun->iLength;
CFX_RectF rect(*pTxtRun->pRect);
- FX_FLOAT fFontSize = pTxtRun->fFontSize;
+ float fFontSize = pTxtRun->fFontSize;
int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
- FX_FLOAT fScale = fFontSize / 1000.0f;
+ float fScale = fFontSize / 1000.0f;
CFX_RetainPtr<CFGAS_GEFont> pFont = pTxtRun->pFont;
if (!pFont)
bCharBBox = false;
@@ -1113,16 +1113,16 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
if (bCharBBox)
bCharBBox = pFont->GetBBox(&bbox);
- FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale);
- FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale);
+ float fLeft = std::max(0.0f, bbox.left * fScale);
+ float fHeight = FXSYS_fabs(bbox.height * fScale);
bool bRTLPiece = !!(pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel);
bool bSingleLine = !!(pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_SingleLine);
bool bCombText = !!(pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_CombText);
wchar_t wch;
wchar_t wLineBreakChar = pTxtRun->wLineBreakChar;
int32_t iCharSize;
- FX_FLOAT fCharSize;
- FX_FLOAT fStart = bRTLPiece ? rect.right() : rect.left;
+ float fCharSize;
+ float fStart = bRTLPiece ? rect.right() : rect.left;
std::vector<CFX_RectF> rtArray(iLength);
for (int32_t i = 0; i < iLength; i++) {
@@ -1133,7 +1133,7 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
wch = *pStr++;
iCharSize = *pWidths++;
}
- fCharSize = static_cast<FX_FLOAT>(iCharSize) / 20000.0f;
+ fCharSize = static_cast<float>(iCharSize) / 20000.0f;
bool bRet = (!bSingleLine && IsCtrlCode(wch));
if (!(wch == L'\v' || wch == L'\f' || wch == 0x2028 || wch == 0x2029 ||
(wLineBreakChar != 0xFEFF && wch == wLineBreakChar))) {
@@ -1155,7 +1155,7 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
if (bCharBBox && !bRet) {
int32_t iCharWidth = 1000;
pFont->GetCharWidth(wch, iCharWidth, false);
- FX_FLOAT fRTLeft = 0, fCharWidth = 0;
+ float fRTLeft = 0, fCharWidth = 0;
if (iCharWidth > 0) {
fCharWidth = iCharWidth * fScale;
fRTLeft = fLeft;
diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h
index fd864f1296..d4aa1418e7 100644
--- a/xfa/fgas/layout/fgas_textbreak.h
+++ b/xfa/fgas/layout/fgas_textbreak.h
@@ -55,7 +55,7 @@ struct FX_TXTRUN {
int32_t* pWidths;
int32_t iLength;
CFX_RetainPtr<CFGAS_GEFont> pFont;
- FX_FLOAT fFontSize;
+ float fFontSize;
uint32_t dwStyles;
int32_t iHorizontalScale;
int32_t iVerticalScale;
@@ -70,19 +70,19 @@ class CFX_TxtBreak {
CFX_TxtBreak();
~CFX_TxtBreak();
- void SetLineWidth(FX_FLOAT fLineWidth);
+ void SetLineWidth(float fLineWidth);
uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; }
void SetLayoutStyles(uint32_t dwLayoutStyles);
void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
- void SetFontSize(FX_FLOAT fFontSize);
- void SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant);
+ void SetFontSize(float fFontSize);
+ void SetTabWidth(float fTabWidth, bool bEquidistant);
void SetDefaultChar(wchar_t wch);
void SetParagraphBreakChar(wchar_t wch);
- void SetLineBreakTolerance(FX_FLOAT fTolerance);
+ void SetLineBreakTolerance(float fTolerance);
void SetHorizontalScale(int32_t iScale);
- void SetCharSpace(FX_FLOAT fCharSpace);
+ void SetCharSpace(float fCharSpace);
void SetAlignment(int32_t iAlignment);
- void SetCombWidth(FX_FLOAT fCombWidth);
+ void SetCombWidth(float fCombWidth);
CFX_BreakType EndBreak(CFX_BreakType dwStatus);
int32_t CountBreakPieces() const;
const CFX_BreakPiece* GetBreakPiece(int32_t index) const;