From 9875889910585b08d2abd372ddc95469baf1a7e9 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 15 Mar 2018 15:02:22 +0000 Subject: Use Width()/Height() methods from rectangles. Change-Id: I07f4363046be920816e8d0dae766c7af833284db Reviewed-on: https://pdfium-review.googlesource.com/28582 Commit-Queue: dsinclair Reviewed-by: dsinclair --- fpdfsdk/pwl/cpwl_appstream.cpp | 20 ++++++++++---------- fpdfsdk/pwl/cpwl_icon.cpp | 8 ++++---- fpdfsdk/pwl/cpwl_scroll_bar.cpp | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'fpdfsdk/pwl') diff --git a/fpdfsdk/pwl/cpwl_appstream.cpp b/fpdfsdk/pwl/cpwl_appstream.cpp index 203a634bfa..38144d1735 100644 --- a/fpdfsdk/pwl/cpwl_appstream.cpp +++ b/fpdfsdk/pwl/cpwl_appstream.cpp @@ -129,8 +129,8 @@ ByteString GetColorAppStream(const CFX_Color& color, } ByteString GetAP_Check(const CFX_FloatRect& crBBox) { - const float fWidth = crBBox.right - crBBox.left; - const float fHeight = crBBox.top - crBBox.bottom; + const float fWidth = crBBox.Width(); + const float fHeight = crBBox.Height(); CFX_PointF pts[8][3] = {{CFX_PointF(0.28f, 0.52f), CFX_PointF(0.27f, 0.48f), CFX_PointF(0.29f, 0.40f)}, @@ -180,8 +180,8 @@ ByteString GetAP_Check(const CFX_FloatRect& crBBox) { ByteString GetAP_Circle(const CFX_FloatRect& crBBox) { std::ostringstream csAP; - float fWidth = crBBox.right - crBBox.left; - float fHeight = crBBox.top - crBBox.bottom; + float fWidth = crBBox.Width(); + float fHeight = crBBox.Height(); CFX_PointF pt1(crBBox.left, crBBox.bottom + fHeight / 2); CFX_PointF pt2(crBBox.left + fWidth / 2, crBBox.top); @@ -236,8 +236,8 @@ ByteString GetAP_Cross(const CFX_FloatRect& crBBox) { ByteString GetAP_Diamond(const CFX_FloatRect& crBBox) { std::ostringstream csAP; - float fWidth = crBBox.right - crBBox.left; - float fHeight = crBBox.top - crBBox.bottom; + float fWidth = crBBox.Width(); + float fHeight = crBBox.Height(); CFX_PointF pt1(crBBox.left, crBBox.bottom + fHeight / 2); CFX_PointF pt2(crBBox.left + fWidth / 2, crBBox.top); @@ -298,8 +298,8 @@ ByteString GetAP_Star(const CFX_FloatRect& crBBox) { ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox, float fRotate) { std::ostringstream csAP; - float fWidth = crBBox.right - crBBox.left; - float fHeight = crBBox.top - crBBox.bottom; + float fWidth = crBBox.Width(); + float fHeight = crBBox.Height(); CFX_PointF pt1(-fWidth / 2, 0); CFX_PointF pt2(0, fHeight / 2); @@ -776,7 +776,7 @@ ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox, case ButtonStyle::kIconTopLabelBottom: if (pIconStream) { if (IsFloatZero(fFontSize)) { - fHeight = rcBBox.top - rcBBox.bottom; + fHeight = rcBBox.Height(); rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right, rcBBox.bottom + fHeight * fAutoFontScale); rcIcon = @@ -800,7 +800,7 @@ ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox, case ButtonStyle::kIconBottomLabelTop: if (pIconStream) { if (IsFloatZero(fFontSize)) { - fHeight = rcBBox.top - rcBBox.bottom; + fHeight = rcBBox.Height(); rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.top - fHeight * fAutoFontScale, rcBBox.right, rcBBox.top); diff --git a/fpdfsdk/pwl/cpwl_icon.cpp b/fpdfsdk/pwl/cpwl_icon.cpp index e7669b3d20..52a4464639 100644 --- a/fpdfsdk/pwl/cpwl_icon.cpp +++ b/fpdfsdk/pwl/cpwl_icon.cpp @@ -67,8 +67,8 @@ std::pair CPWL_Icon::GetScale() { return {fHScale, fVScale}; CFX_FloatRect rcPlate = GetClientRect(); - float fPlateWidth = rcPlate.right - rcPlate.left; - float fPlateHeight = rcPlate.top - rcPlate.bottom; + float fPlateWidth = rcPlate.Width(); + float fPlateHeight = rcPlate.Height(); float fImageWidth; float fImageHeight; @@ -123,8 +123,8 @@ std::pair CPWL_Icon::GetImageOffset() { float fImageFactHeight = fImageHeight * fVScale; CFX_FloatRect rcPlate = GetClientRect(); - float fPlateWidth = rcPlate.right - rcPlate.left; - float fPlateHeight = rcPlate.top - rcPlate.bottom; + float fPlateWidth = rcPlate.Width(); + float fPlateHeight = rcPlate.Height(); return {(fPlateWidth - fImageFactWidth) * fLeft, (fPlateHeight - fImageFactHeight) * fBottom}; diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp index 65a51e37e8..d71ce353d0 100644 --- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp +++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp @@ -833,10 +833,10 @@ CFX_FloatRect CPWL_ScrollBar::GetScrollArea() const { CFX_FloatRect rcMin = m_pMinButton->GetWindowRect(); CFX_FloatRect rcMax = m_pMaxButton->GetWindowRect(); - float fMinWidth = rcMin.right - rcMin.left; - float fMinHeight = rcMin.top - rcMin.bottom; - float fMaxWidth = rcMax.right - rcMax.left; - float fMaxHeight = rcMax.top - rcMax.bottom; + float fMinWidth = rcMin.Width(); + float fMinHeight = rcMin.Height(); + float fMaxWidth = rcMax.Width(); + float fMaxHeight = rcMax.Height(); switch (m_sbType) { case SBT_HSCROLL: -- cgit v1.2.3