summaryrefslogtreecommitdiff
path: root/xfa/fgas
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-04-30 21:54:13 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-30 21:54:13 +0000
commit3d3c2dea9fcb7372e195f453a5e4ec3fd47392b9 (patch)
tree443142fe49a3c509d7664b8c3a4b2901278f6066 /xfa/fgas
parent39e7e610d8d697f05134890446caf4101539a032 (diff)
downloadpdfium-3d3c2dea9fcb7372e195f453a5e4ec3fd47392b9.tar.xz
Change out parameter of CFGAS_GEFont::GetCharWidth to pointer.chromium/3416
Change-Id: I1e04c7645b2238d292a6a8eb5fb5fa365fa958f5 Reviewed-on: https://pdfium-review.googlesource.com/31752 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fgas')
-rw-r--r--xfa/fgas/font/cfgas_gefont.cpp24
-rw-r--r--xfa/fgas/font/cfgas_gefont.h2
-rw-r--r--xfa/fgas/layout/cfx_break.cpp4
-rw-r--r--xfa/fgas/layout/cfx_rtfbreak.cpp12
-rw-r--r--xfa/fgas/layout/cfx_txtbreak.cpp16
5 files changed, 29 insertions, 29 deletions
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index 35d3480d03..b6ec23a414 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -155,34 +155,34 @@ uint32_t CFGAS_GEFont::GetFontStyles() const {
return dwStyles;
}
-bool CFGAS_GEFont::GetCharWidth(wchar_t wUnicode, int32_t& iWidth) {
+bool CFGAS_GEFont::GetCharWidth(wchar_t wUnicode, int32_t* pWidth) {
auto it = m_CharWidthMap.find(wUnicode);
- iWidth = it != m_CharWidthMap.end() ? it->second : 0;
- if (iWidth == 65535)
+ *pWidth = it != m_CharWidthMap.end() ? it->second : 0;
+ if (*pWidth == 65535)
return false;
- if (iWidth > 0)
+ if (*pWidth > 0)
return true;
if (!m_pProvider || !m_pProvider->GetCharWidth(RetainPtr<CFGAS_GEFont>(this),
- wUnicode, &iWidth)) {
+ wUnicode, pWidth)) {
RetainPtr<CFGAS_GEFont> pFont;
int32_t iGlyph;
std::tie(iGlyph, pFont) = GetGlyphIndexAndFont(wUnicode, true);
if (iGlyph != 0xFFFF && pFont) {
if (pFont.Get() == this) {
- iWidth = m_pFont->GetGlyphWidth(iGlyph);
- if (iWidth < 0)
- iWidth = -1;
- } else if (pFont->GetCharWidth(wUnicode, iWidth)) {
+ *pWidth = m_pFont->GetGlyphWidth(iGlyph);
+ if (*pWidth < 0)
+ *pWidth = -1;
+ } else if (pFont->GetCharWidth(wUnicode, pWidth)) {
return true;
}
} else {
- iWidth = -1;
+ *pWidth = -1;
}
}
- m_CharWidthMap[wUnicode] = iWidth;
- return iWidth > 0;
+ m_CharWidthMap[wUnicode] = *pWidth;
+ return *pWidth > 0;
}
bool CFGAS_GEFont::GetCharBBox(wchar_t wUnicode, FX_RECT* bbox) {
diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h
index b1d3a0e34d..ab72f1356f 100644
--- a/xfa/fgas/font/cfgas_gefont.h
+++ b/xfa/fgas/font/cfgas_gefont.h
@@ -38,7 +38,7 @@ class CFGAS_GEFont : public Retainable {
CFGAS_FontMgr* pFontMgr);
uint32_t GetFontStyles() const;
- bool GetCharWidth(wchar_t wUnicode, int32_t& iWidth);
+ bool GetCharWidth(wchar_t wUnicode, int32_t* pWidth);
int32_t GetGlyphIndex(wchar_t wUnicode);
int32_t GetAscent() const;
int32_t GetDescent() const;
diff --git a/xfa/fgas/layout/cfx_break.cpp b/xfa/fgas/layout/cfx_break.cpp
index 0f52a2d274..b9996b3141 100644
--- a/xfa/fgas/layout/cfx_break.cpp
+++ b/xfa/fgas/layout/cfx_break.cpp
@@ -113,7 +113,7 @@ void CFX_Break::FontChanged() {
if (!m_pFont || m_wDefChar == 0xFEFF)
return;
- m_pFont->GetCharWidth(m_wDefChar, m_iDefChar);
+ m_pFont->GetCharWidth(m_wDefChar, &m_iDefChar);
m_iDefChar *= m_iFontSize;
}
@@ -130,7 +130,7 @@ void CFX_Break::SetDefaultChar(wchar_t wch) {
if (m_wDefChar == 0xFEFF || !m_pFont)
return;
- m_pFont->GetCharWidth(m_wDefChar, m_iDefChar);
+ m_pFont->GetCharWidth(m_wDefChar, &m_iDefChar);
if (m_iDefChar < 0)
m_iDefChar = 0;
else
diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp
index 9497e5fde6..1e7587a16e 100644
--- a/xfa/fgas/layout/cfx_rtfbreak.cpp
+++ b/xfa/fgas/layout/cfx_rtfbreak.cpp
@@ -122,7 +122,7 @@ CFX_BreakType CFX_RTFBreak::AppendChar(wchar_t wch) {
void CFX_RTFBreak::AppendChar_Combination(CFX_Char* pCurChar) {
int32_t iCharWidth = 0;
- if (!m_pFont->GetCharWidth(pCurChar->char_code(), iCharWidth))
+ if (!m_pFont->GetCharWidth(pCurChar->char_code(), &iCharWidth))
iCharWidth = 0;
iCharWidth *= m_iFontSize;
@@ -191,8 +191,8 @@ CFX_BreakType CFX_RTFBreak::AppendChar_Arabic(CFX_Char* pCurChar) {
wForm = pdfium::arabic::GetFormChar(pLastChar, pPrevChar, pCurChar);
bAlef = (wForm == 0xFEFF &&
pLastChar->GetCharType() == FX_CHARTYPE_ArabicAlef);
- if (!m_pFont->GetCharWidth(wForm, iCharWidth) &&
- !m_pFont->GetCharWidth(pLastChar->char_code(), iCharWidth)) {
+ if (!m_pFont->GetCharWidth(wForm, &iCharWidth) &&
+ !m_pFont->GetCharWidth(pLastChar->char_code(), &iCharWidth)) {
iCharWidth = m_iDefChar;
}
@@ -206,8 +206,8 @@ CFX_BreakType CFX_RTFBreak::AppendChar_Arabic(CFX_Char* pCurChar) {
wForm = pdfium::arabic::GetFormChar(pCurChar, bAlef ? nullptr : pLastChar,
nullptr);
- if (!m_pFont->GetCharWidth(wForm, iCharWidth) &&
- !m_pFont->GetCharWidth(pCurChar->char_code(), iCharWidth)) {
+ if (!m_pFont->GetCharWidth(wForm, &iCharWidth) &&
+ !m_pFont->GetCharWidth(pCurChar->char_code(), &iCharWidth)) {
iCharWidth = m_iDefChar;
}
@@ -226,7 +226,7 @@ CFX_BreakType CFX_RTFBreak::AppendChar_Others(CFX_Char* pCurChar) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
wchar_t wForm = pCurChar->char_code();
int32_t iCharWidth = 0;
- if (!m_pFont->GetCharWidth(wForm, iCharWidth))
+ if (!m_pFont->GetCharWidth(wForm, &iCharWidth))
iCharWidth = m_iDefChar;
iCharWidth *= m_iFontSize;
diff --git a/xfa/fgas/layout/cfx_txtbreak.cpp b/xfa/fgas/layout/cfx_txtbreak.cpp
index 3c7039de28..67140c4711 100644
--- a/xfa/fgas/layout/cfx_txtbreak.cpp
+++ b/xfa/fgas/layout/cfx_txtbreak.cpp
@@ -79,7 +79,7 @@ void CFX_TxtBreak::AppendChar_Combination(CFX_Char* pCurChar) {
}
}
int32_t iCharWidthOut;
- if (m_pFont->GetCharWidth(wForm, iCharWidthOut))
+ if (m_pFont->GetCharWidth(wForm, &iCharWidthOut))
iCharWidth = iCharWidthOut;
else
iCharWidth = 0;
@@ -144,7 +144,7 @@ CFX_BreakType CFX_TxtBreak::AppendChar_Arabic(CFX_Char* pCurChar) {
bAlef = (wForm == 0xFEFF &&
pLastChar->GetCharType() == FX_CHARTYPE_ArabicAlef);
int32_t iCharWidthOut;
- m_pFont->GetCharWidth(wForm, iCharWidthOut);
+ m_pFont->GetCharWidth(wForm, &iCharWidthOut);
iCharWidth = iCharWidthOut;
if (wForm == 0xFEFF)
@@ -169,7 +169,7 @@ CFX_BreakType CFX_TxtBreak::AppendChar_Arabic(CFX_Char* pCurChar) {
iCharWidth = m_iCombWidth;
} else {
int32_t iCharWidthOut;
- m_pFont->GetCharWidth(wForm, iCharWidthOut);
+ m_pFont->GetCharWidth(wForm, &iCharWidthOut);
iCharWidth = iCharWidthOut;
if (wForm == 0xFEFF)
@@ -201,7 +201,7 @@ CFX_BreakType CFX_TxtBreak::AppendChar_Others(CFX_Char* pCurChar) {
iCharWidth = m_iCombWidth;
} else {
int32_t iCharWidthOut;
- if (m_pFont->GetCharWidth(wForm, iCharWidthOut))
+ if (m_pFont->GetCharWidth(wForm, &iCharWidthOut))
iCharWidth = iCharWidthOut;
else
iCharWidth = m_iDefChar;
@@ -838,11 +838,11 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
if (bLam) {
formChars[1].wForm = 0x0651;
iCharWidth = 0;
- pFont->GetCharWidth(0x0651, iCharWidth);
+ pFont->GetCharWidth(0x0651, &iCharWidth);
formChars[1].iWidth = iCharWidth;
formChars[2].wForm = 0x0670;
iCharWidth = 0;
- pFont->GetCharWidth(0x0670, iCharWidth);
+ pFont->GetCharWidth(0x0670, &iCharWidth);
formChars[2].iWidth = iCharWidth;
}
@@ -873,7 +873,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
if ((dwStyles & FX_LAYOUTSTYLE_CombText) != 0) {
int32_t iFormWidth = iCharWidth;
- pFont->GetCharWidth(wForm, iFormWidth);
+ pFont->GetCharWidth(wForm, &iFormWidth);
float fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f;
pCharPos->m_Origin.x += fOffset;
}
@@ -987,7 +987,7 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
if (bCharBBox && !bRet) {
int32_t iCharWidth = 1000;
- pFont->GetCharWidth(wch, iCharWidth);
+ pFont->GetCharWidth(wch, &iCharWidth);
float fRTLeft = 0, fCharWidth = 0;
if (iCharWidth > 0) {
fCharWidth = iCharWidth * fScale;