summaryrefslogtreecommitdiff
path: root/xfa/fde
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-05-01 21:00:44 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-01 21:00:44 +0000
commit0b0b0b32bc2b03f09b7156b855c626a44703f9c4 (patch)
tree411225574a545e49ae4d883082be6a013460b7c6 /xfa/fde
parent9294ffdf371fbae8c166dd5e3c63955f1d3ab18e (diff)
downloadpdfium-0b0b0b32bc2b03f09b7156b855c626a44703f9c4.tar.xz
Transform rect out param from reference to pointer in XFA code.
Change-Id: Ib5f8b8754bca8198d9122700d7d876b45d1428da Reviewed-on: https://pdfium-review.googlesource.com/31852 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fde')
-rw-r--r--xfa/fde/cfde_texteditengine.cpp2
-rw-r--r--xfa/fde/cfde_textout.cpp34
-rw-r--r--xfa/fde/cfde_textout.h4
3 files changed, 20 insertions, 20 deletions
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp
index 0157b353cf..87dba53158 100644
--- a/xfa/fde/cfde_texteditengine.cpp
+++ b/xfa/fde/cfde_texteditengine.cpp
@@ -246,7 +246,7 @@ size_t CFDE_TextEditEngine::CountCharsExceedingSize(const WideString& text,
for (size_t i = 0; i < num_to_check; i++) {
// This does a lot of string copying ....
// TODO(dsinclair): make CalcLogicSize take a WideStringC instead.
- text_out->CalcLogicSize(WideString(temp), text_rect);
+ text_out->CalcLogicSize(WideString(temp), &text_rect);
if (limit_horizontal_area_ && text_rect.width <= available_width_)
break;
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index ab5f9c0f85..b8049fbe82 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -194,32 +194,32 @@ void CFDE_TextOut::SetLineBreakTolerance(float fTolerance) {
m_pTxtBreak->SetLineBreakTolerance(m_fTolerance);
}
-void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_SizeF& size) {
- CFX_RectF rtText(0.0f, 0.0f, size.width, size.height);
- CalcLogicSize(str, rtText);
- size = rtText.Size();
+void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_SizeF* pSize) {
+ CFX_RectF rtText(0.0f, 0.0f, pSize->width, pSize->height);
+ CalcLogicSize(str, &rtText);
+ *pSize = rtText.Size();
}
-void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_RectF& rect) {
+void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_RectF* pRect) {
if (str.IsEmpty()) {
- rect.width = 0.0f;
- rect.height = 0.0f;
+ pRect->width = 0.0f;
+ pRect->height = 0.0f;
return;
}
ASSERT(m_pFont && m_fFontSize >= 1.0f);
if (!m_Styles.single_line_) {
- if (rect.Width() < 1.0f)
- rect.width = m_fFontSize * 1000.0f;
+ if (pRect->Width() < 1.0f)
+ pRect->width = m_fFontSize * 1000.0f;
- m_pTxtBreak->SetLineWidth(rect.Width());
+ m_pTxtBreak->SetLineWidth(pRect->Width());
}
m_iTotalLines = 0;
float fWidth = 0.0f;
float fHeight = 0.0f;
- float fStartPos = rect.right();
+ float fStartPos = pRect->right();
CFX_BreakType dwBreakStatus = CFX_BreakType::None;
bool break_char_is_set = false;
for (const wchar_t& wch : str) {
@@ -237,18 +237,18 @@ void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_RectF& rect) {
RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight);
m_pTxtBreak->Reset();
- float fInc = rect.Height() - fHeight;
+ float fInc = pRect->Height() - fHeight;
if (TextAlignmentVerticallyCentered(m_iAlignment))
fInc /= 2.0f;
else if (IsTextAlignmentTop(m_iAlignment))
fInc = 0.0f;
- rect.left += fStartPos;
- rect.top += fInc;
- rect.width = std::min(fWidth, rect.Width());
- rect.height = fHeight;
+ pRect->left += fStartPos;
+ pRect->top += fInc;
+ pRect->width = std::min(fWidth, pRect->Width());
+ pRect->height = fHeight;
if (m_Styles.last_line_height_)
- rect.height -= m_fLineSpace - m_fFontSize;
+ pRect->height -= m_fLineSpace - m_fFontSize;
}
bool CFDE_TextOut::RetrieveLineWidth(CFX_BreakType dwBreakStatus,
diff --git a/xfa/fde/cfde_textout.h b/xfa/fde/cfde_textout.h
index 6e72f8c441..5014d9517c 100644
--- a/xfa/fde/cfde_textout.h
+++ b/xfa/fde/cfde_textout.h
@@ -55,8 +55,8 @@ class CFDE_TextOut {
void SetMatrix(const CFX_Matrix& matrix) { m_Matrix = matrix; }
void SetLineBreakTolerance(float fTolerance);
- void CalcLogicSize(const WideString& str, CFX_SizeF& size);
- void CalcLogicSize(const WideString& str, CFX_RectF& rect);
+ void CalcLogicSize(const WideString& str, CFX_SizeF* pSize);
+ void CalcLogicSize(const WideString& str, CFX_RectF* pRect);
void DrawLogicText(CFX_RenderDevice* device,
const WideStringView& str,
const CFX_RectF& rect);