diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-07 16:36:39 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-08 01:36:02 +0000 |
commit | bba2a7cf30da9e84bcc14ef32dbb0bb944229219 (patch) | |
tree | 94a74de8d07b3e395bf6e08a62811a3a0d652d19 /xfa/fde/tto | |
parent | 55e026b7b6eec17b012c819c4a7d39e63094b5c4 (diff) | |
download | pdfium-bba2a7cf30da9e84bcc14ef32dbb0bb944229219.tar.xz |
Update to use CFX_Rect{F} and CFX_Matrix constructors.
This Cl updates the code to use the constructors instead of creating an
empty object and calling Set(). It also removes the various memsets of
the CFX_Rect{F} classes.
Change-Id: I6e20cec00866a38372858dcba5a30d31103172e4
Reviewed-on: https://pdfium-review.googlesource.com/2550
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fde/tto')
-rw-r--r-- | xfa/fde/tto/fde_textout.cpp | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index ca5aa566e1..b126d4e583 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -138,8 +138,10 @@ void CFDE_TextOut::SetRenderDevice(CFX_RenderDevice* pDevice) { } void CFDE_TextOut::SetClipRect(const CFX_Rect& rtClip) { - m_rtClip.Set((FX_FLOAT)rtClip.left, (FX_FLOAT)rtClip.top, - (FX_FLOAT)rtClip.Width(), (FX_FLOAT)rtClip.Height()); + m_rtClip = CFX_RectF(static_cast<FX_FLOAT>(rtClip.left), + static_cast<FX_FLOAT>(rtClip.top), + static_cast<FX_FLOAT>(rtClip.Width()), + static_cast<FX_FLOAT>(rtClip.Height())); } void CFDE_TextOut::SetClipRect(const CFX_RectF& rtClip) { @@ -166,8 +168,8 @@ int32_t CFDE_TextOut::GetTotalLines() { void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_Size& size) { - CFX_RectF rtText; - rtText.Set(0.0f, 0.0f, (FX_FLOAT)size.x, (FX_FLOAT)size.y); + CFX_RectF rtText(0.0f, 0.0f, static_cast<FX_FLOAT>(size.x), + static_cast<FX_FLOAT>(size.y)); CalcSize(pwsStr, iLength, rtText); size.x = (int32_t)rtText.Width(); size.y = (int32_t)rtText.Height(); @@ -176,8 +178,7 @@ void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_SizeF& size) { - CFX_RectF rtText; - rtText.Set(0.0f, 0.0f, size.x, size.y); + CFX_RectF rtText(0.0f, 0.0f, size.x, size.y); CalcSize(pwsStr, iLength, rtText); size.x = rtText.Width(); size.y = rtText.Height(); @@ -186,12 +187,15 @@ void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_Rect& rect) { - CFX_RectF rtText; - rtText.Set((FX_FLOAT)rect.left, (FX_FLOAT)rect.top, (FX_FLOAT)rect.Width(), - (FX_FLOAT)rect.Height()); + CFX_RectF rtText(static_cast<FX_FLOAT>(rect.left), + static_cast<FX_FLOAT>(rect.top), + static_cast<FX_FLOAT>(rect.Width()), + static_cast<FX_FLOAT>(rect.Height())); CalcSize(pwsStr, iLength, rtText); - rect.Set((int32_t)rtText.left, (int32_t)rtText.top, (int32_t)rtText.Width(), - (int32_t)rtText.Height()); + rect = CFX_Rect(static_cast<int32_t>(rtText.left), + static_cast<int32_t>(rtText.top), + static_cast<int32_t>(rtText.Width()), + static_cast<int32_t>(rtText.Height())); } void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, @@ -212,8 +216,7 @@ void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_SizeF& size) { - CFX_RectF rtText; - rtText.Set(0.0f, 0.0f, size.x, size.y); + CFX_RectF rtText(0.0f, 0.0f, size.x, size.y); CalcLogicSize(pwsStr, iLength, rtText); size.x = rtText.Width(); size.y = rtText.Height(); @@ -346,9 +349,8 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, int32_t iLength, int32_t x, int32_t y) { - CFX_RectF rtText; - rtText.Set((FX_FLOAT)x, (FX_FLOAT)y, m_fFontSize * 1000.0f, - m_fFontSize * 1000.0f); + CFX_RectF rtText(static_cast<FX_FLOAT>(x), static_cast<FX_FLOAT>(y), + m_fFontSize * 1000.0f, m_fFontSize * 1000.0f); DrawText(pwsStr, iLength, rtText); } @@ -356,25 +358,23 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y) { - CFX_RectF rtText; - rtText.Set(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f); + CFX_RectF rtText(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f); DrawText(pwsStr, iLength, rtText); } void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_Rect& rect) { - CFX_RectF rtText; - rtText.Set((FX_FLOAT)rect.left, (FX_FLOAT)rect.top, (FX_FLOAT)rect.width, - (FX_FLOAT)rect.height); + CFX_RectF rtText( + static_cast<FX_FLOAT>(rect.left), static_cast<FX_FLOAT>(rect.top), + static_cast<FX_FLOAT>(rect.width), static_cast<FX_FLOAT>(rect.height)); DrawText(pwsStr, iLength, rtText); } void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_RectF& rect) { - CFX_RectF rtText; - rtText.Set(rect.left, rect.top, rect.width, rect.height); + CFX_RectF rtText(rect.left, rect.top, rect.width, rect.height); CFX_Matrix rm; rm.SetReverse(m_Matrix); rm.TransformRect(rtText); @@ -385,17 +385,15 @@ void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y) { - CFX_RectF rtText; - rtText.Set(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f); + CFX_RectF rtText(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f); DrawLogicText(pwsStr, iLength, rtText); } void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_RectF& rect) { - CFX_RectF rtClip; - rtClip.Set(m_rtLogicClip.left, m_rtLogicClip.top, m_rtLogicClip.width, - m_rtLogicClip.height); + CFX_RectF rtClip(m_rtLogicClip.left, m_rtLogicClip.top, m_rtLogicClip.width, + m_rtLogicClip.height); m_Matrix.TransformRect(rtClip); DrawText(pwsStr, iLength, rect, rtClip); } |