diff options
author | Lei Zhang <thestig@chromium.org> | 2018-03-15 15:02:22 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-03-15 15:02:22 +0000 |
commit | 9875889910585b08d2abd372ddc95469baf1a7e9 (patch) | |
tree | dac7825a580bed8bc2767e4e877c814705e6b783 /fpdfsdk | |
parent | 0a68fd65bb2ced78bc57769cde8ecd16a175c84f (diff) | |
download | pdfium-9875889910585b08d2abd372ddc95469baf1a7e9.tar.xz |
Use Width()/Height() methods from rectangles.
Change-Id: I07f4363046be920816e8d0dae766c7af833284db
Reviewed-on: https://pdfium-review.googlesource.com/28582
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/cpdfsdk_widget.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_appstream.cpp | 20 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_icon.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_scroll_bar.cpp | 8 |
5 files changed, 24 insertions, 24 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index 1496beeb8e..20189ef4d6 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -744,8 +744,8 @@ CFX_FloatRect CPDFSDK_Widget::GetClientRect() const { CFX_FloatRect CPDFSDK_Widget::GetRotatedRect() const { CFX_FloatRect rectAnnot = GetRect(); - float fWidth = rectAnnot.right - rectAnnot.left; - float fHeight = rectAnnot.top - rectAnnot.bottom; + float fWidth = rectAnnot.Width(); + float fHeight = rectAnnot.Height(); CPDF_FormControl* pControl = GetFormControl(); CFX_FloatRect rcPDFWindow; @@ -768,8 +768,8 @@ CFX_Matrix CPDFSDK_Widget::GetMatrix() const { CFX_Matrix mt; CPDF_FormControl* pControl = GetFormControl(); CFX_FloatRect rcAnnot = GetRect(); - float fWidth = rcAnnot.right - rcAnnot.left; - float fHeight = rcAnnot.top - rcAnnot.bottom; + float fWidth = rcAnnot.Width(); + float fHeight = rcAnnot.Height(); switch (abs(pControl->GetRotation() % 360)) { default: diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index d3aa37e4d5..2e2aab9c8f 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -416,8 +416,8 @@ CFX_Matrix CFFL_FormFiller::GetCurMatrix() { CFX_FloatRect CFFL_FormFiller::GetPDFWindowRect() const { CFX_FloatRect rectAnnot = m_pWidget->GetPDFAnnot()->GetRect(); - float fWidth = rectAnnot.right - rectAnnot.left; - float fHeight = rectAnnot.top - rectAnnot.bottom; + float fWidth = rectAnnot.Width(); + float fHeight = rectAnnot.Height(); if ((m_pWidget->GetRotate() / 90) & 0x01) std::swap(fWidth, fHeight); return CFX_FloatRect(0, 0, fWidth, fHeight); 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<float, float> 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<float, float> 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: |