summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-07-13 21:36:29 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-17 15:43:06 +0000
commitd6aff2f2e8469344becd6f73e443c31bca9baac0 (patch)
tree1e14517547352b92e66f5256652debb3341acec4 /fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
parent18531230381465592e1a037e6dfc39d4a6fb5def (diff)
downloadpdfium-d6aff2f2e8469344becd6f73e443c31bca9baac0.tar.xz
Add CFX_FloatRect::GetDeflated
This CL adds a method to CFX_FloatRect to get a new deflated rectangle from a given rectangle. Change-Id: I781222257c82baf94d5f77deede52fbe4e97c701 Reviewed-on: https://pdfium-review.googlesource.com/7850 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
index 491d0b3876..dc153fda37 100644
--- a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
@@ -242,31 +242,23 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
// draw border
- CFX_FloatRect rcDraw = rectWnd;
- CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
+ CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rectWnd,
ArgbEncode(nTransparency, 100, 100, 100), 0.0f);
// draw inner border
- rcDraw = rectWnd;
- if (!rcDraw.IsEmpty()) {
- rcDraw.Deflate(0.5f, 0.5f);
- rcDraw.Normalize();
- }
- CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
+ CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device,
+ rectWnd.GetDeflated(0.5f, 0.5f),
ArgbEncode(nTransparency, 255, 255, 255), 1.0f);
if (m_eSBButtonType != PSBT_POS) {
// draw background
- rcDraw = rectWnd;
- if (!rcDraw.IsEmpty()) {
- rcDraw.Deflate(1.0f, 1.0f);
- rcDraw.Normalize();
- }
if (IsEnabled()) {
- CPWL_Utils::DrawShadow(pDevice, pUser2Device, true, false, rcDraw,
- nTransparency, 80, 220);
+ CPWL_Utils::DrawShadow(pDevice, pUser2Device, true, false,
+ rectWnd.GetDeflated(1.0f, 1.0f), nTransparency, 80,
+ 220);
} else {
- CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw,
+ CPWL_Utils::DrawFillRect(pDevice, pUser2Device,
+ rectWnd.GetDeflated(1.0f, 1.0f),
ArgbEncode(255, 255, 255, 255));
}
@@ -326,7 +318,8 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
ptBottom.x += 1.0f;
}
} else {
- CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw,
+ CPWL_Utils::DrawFillRect(pDevice, pUser2Device,
+ rectWnd.GetDeflated(0.5f, 0.5f),
ArgbEncode(255, 255, 255, 255));
}