summaryrefslogtreecommitdiff
path: root/fpdfsdk/pwl/cpwl_list_box.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-08-15 13:56:43 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-08-15 21:33:32 +0000
commiteb14e04c79c575146fe96c025dbf56b7440870c7 (patch)
tree323ca30b3b5b2df46427e336c3482901ca26db8f /fpdfsdk/pwl/cpwl_list_box.cpp
parent6e524ad89eac22f0e5d5475652ec78c609b788e8 (diff)
downloadpdfium-chromium/3187.tar.xz
Change a bunch of methods to take a const CFX_Matrix& param.chromium/3187
Simplify some code along the way. Change-Id: I0022c8a82188192c63b9ac0bc87e9b9dbf983040 Reviewed-on: https://pdfium-review.googlesource.com/10852 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/pwl/cpwl_list_box.cpp')
-rw-r--r--fpdfsdk/pwl/cpwl_list_box.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp
index 060b3f6ee3..a9c553ee5b 100644
--- a/fpdfsdk/pwl/cpwl_list_box.cpp
+++ b/fpdfsdk/pwl/cpwl_list_box.cpp
@@ -38,18 +38,20 @@ void CPWL_List_Notify::IOnSetScrollInfoY(float fPlateMin,
Info.fBigStep = fBigStep;
m_pList->SetScrollInfo(Info);
- if (CPWL_ScrollBar* pScroll = m_pList->GetVScrollBar()) {
- if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) ||
- IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) {
- if (pScroll->IsVisible()) {
- pScroll->SetVisible(false);
- m_pList->RePosChildWnd();
- }
- } else {
- if (!pScroll->IsVisible()) {
- pScroll->SetVisible(true);
- m_pList->RePosChildWnd();
- }
+ CPWL_ScrollBar* pScroll = m_pList->GetVScrollBar();
+ if (!pScroll)
+ return;
+
+ if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) ||
+ IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) {
+ if (pScroll->IsVisible()) {
+ pScroll->SetVisible(false);
+ m_pList->RePosChildWnd();
+ }
+ } else {
+ if (!pScroll->IsVisible()) {
+ pScroll->SetVisible(true);
+ m_pList->RePosChildWnd();
}
}
}
@@ -94,8 +96,8 @@ void CPWL_ListBox::OnDestroy() {
}
void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
- CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
+ const CFX_Matrix& mtUser2Device) {
+ CPWL_Wnd::DrawThisAppearance(pDevice, mtUser2Device);
CFX_FloatRect rcPlate = m_pList->GetPlateRect();
CFX_FloatRect rcList = GetListRect();
@@ -118,21 +120,21 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
if (m_pList->IsItemSelected(i)) {
CFX_SystemHandler* pSysHandler = GetSystemHandler();
if (pSysHandler && pSysHandler->IsSelectionImplemented()) {
- CPWL_EditImpl::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
+ CPWL_EditImpl::DrawEdit(pDevice, mtUser2Device, m_pList->GetItemEdit(i),
GetTextColor().ToFXColor(255), rcList, ptOffset,
nullptr, pSysHandler, m_pFormFiller.Get());
pSysHandler->OutputSelectedRect(m_pFormFiller.Get(), rcItem);
} else {
- pDevice->DrawFillRect(pUser2Device, rcItem,
+ pDevice->DrawFillRect(&mtUser2Device, rcItem,
ArgbEncode(255, 0, 51, 113));
- CPWL_EditImpl::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
+ CPWL_EditImpl::DrawEdit(pDevice, mtUser2Device, m_pList->GetItemEdit(i),
ArgbEncode(255, 255, 255, 255), rcList,
ptOffset, nullptr, pSysHandler,
m_pFormFiller.Get());
}
} else {
CFX_SystemHandler* pSysHandler = GetSystemHandler();
- CPWL_EditImpl::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
+ CPWL_EditImpl::DrawEdit(pDevice, mtUser2Device, m_pList->GetItemEdit(i),
GetTextColor().ToFXColor(255), rcList, ptOffset,
nullptr, pSysHandler, nullptr);
}