From 071d78690a4e2becffaeeb32fe210ee58ab3e532 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Tue, 7 Feb 2017 20:46:32 -0500 Subject: Rename x,y to width,height for Size types This Cl fixes the naming of the size types to match their purpose. This makes the code clearer. Change-Id: I37a41ab0fe01782f4749054f1f8ab29ddf8d2790 Reviewed-on: https://pdfium-review.googlesource.com/2551 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fde/tto/fde_textout.cpp | 67 ++++----------------------------------------- xfa/fde/tto/fde_textout.h | 4 --- 2 files changed, 6 insertions(+), 65 deletions(-) (limited to 'xfa/fde') diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index b126d4e583..9011b8950f 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -138,10 +138,7 @@ void CFDE_TextOut::SetRenderDevice(CFX_RenderDevice* pDevice) { } void CFDE_TextOut::SetClipRect(const CFX_Rect& rtClip) { - m_rtClip = CFX_RectF(static_cast(rtClip.left), - static_cast(rtClip.top), - static_cast(rtClip.Width()), - static_cast(rtClip.Height())); + m_rtClip = rtClip.As(); } void CFDE_TextOut::SetClipRect(const CFX_RectF& rtClip) { @@ -165,61 +162,12 @@ int32_t CFDE_TextOut::GetTotalLines() { return m_iTotalLines; } -void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, - int32_t iLength, - CFX_Size& size) { - CFX_RectF rtText(0.0f, 0.0f, static_cast(size.x), - static_cast(size.y)); - CalcSize(pwsStr, iLength, rtText); - size.x = (int32_t)rtText.Width(); - size.y = (int32_t)rtText.Height(); -} - -void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, - int32_t iLength, - CFX_SizeF& size) { - CFX_RectF rtText(0.0f, 0.0f, size.x, size.y); - CalcSize(pwsStr, iLength, rtText); - size.x = rtText.Width(); - size.y = rtText.Height(); -} - -void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, - int32_t iLength, - CFX_Rect& rect) { - CFX_RectF rtText(static_cast(rect.left), - static_cast(rect.top), - static_cast(rect.Width()), - static_cast(rect.Height())); - CalcSize(pwsStr, iLength, rtText); - rect = CFX_Rect(static_cast(rtText.left), - static_cast(rtText.top), - static_cast(rtText.Width()), - static_cast(rtText.Height())); -} - -void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, - int32_t iLength, - CFX_RectF& rect) { - if (!pwsStr || iLength < 1) { - rect.width = 0.0f; - rect.height = 0.0f; - } else { - CFX_Matrix rm; - rm.SetReverse(m_Matrix); - rm.TransformRect(rect); - CalcTextSize(pwsStr, iLength, rect); - m_Matrix.TransformRect(rect); - } -} - void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_SizeF& size) { - CFX_RectF rtText(0.0f, 0.0f, size.x, size.y); + CFX_RectF rtText(0.0f, 0.0f, size.width, size.height); CalcLogicSize(pwsStr, iLength, rtText); - size.x = rtText.Width(); - size.y = rtText.Height(); + size = rtText.Size(); } void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, @@ -358,17 +306,14 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y) { - CFX_RectF rtText(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f); - DrawText(pwsStr, iLength, rtText); + DrawText(pwsStr, iLength, + CFX_RectF(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f)); } void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_Rect& rect) { - CFX_RectF rtText( - static_cast(rect.left), static_cast(rect.top), - static_cast(rect.width), static_cast(rect.height)); - DrawText(pwsStr, iLength, rtText); + DrawText(pwsStr, iLength, rect.As()); } void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h index 97ec1251f4..2cd1bcdb70 100644 --- a/xfa/fde/tto/fde_textout.h +++ b/xfa/fde/tto/fde_textout.h @@ -99,10 +99,6 @@ class CFDE_TextOut { void SetClipRect(const CFX_RectF& rtClip); void SetMatrix(const CFX_Matrix& matrix); void SetLineBreakTolerance(FX_FLOAT fTolerance); - void CalcSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_Size& size); - void CalcSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_SizeF& size); - void CalcSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_Rect& rect); - void CalcSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_RectF& rect); void DrawText(const FX_WCHAR* pwsStr, int32_t iLength, int32_t x, int32_t y); void DrawText(const FX_WCHAR* pwsStr, -- cgit v1.2.3