summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/TSButton.cpp
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-03-05 22:14:09 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-03-05 22:14:09 +0000
commit18a91339f2d9e1449887f5d993ab2f038ff56833 (patch)
treec5ee079c530794040fee8d2cfb497bd799545735 /plugins/TabSRMM/src/TSButton.cpp
parentb915069a9d7ad8d4da5da7a7d92d3e73a0a65346 (diff)
TabSRMM: code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@12344 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/TSButton.cpp')
-rw-r--r--plugins/TabSRMM/src/TSButton.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp
index b55e8ff26e..fd81fd31a3 100644
--- a/plugins/TabSRMM/src/TSButton.cpp
+++ b/plugins/TabSRMM/src/TSButton.cpp
@@ -95,7 +95,11 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint)
bf_buttonglyph.AlphaFormat = 0;
}
- if (hdcPaint == NULL)
+ if (ctl == NULL || hdcPaint == NULL)
+ return;
+
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(GetParent(ctl->hwnd), GWLP_USERDATA);
+ if (dat == NULL)
return;
HDC hdcMem;
@@ -103,8 +107,6 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint)
HANDLE hbp = 0;
bool bAero = M.isAero();
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(GetParent(ctl->hwnd), GWLP_USERDATA);
-
RECT rcClient, rcContent;
GetClientRect(ctl->hwnd, const_cast<RECT *>(&rcClient));
CopyRect(&rcContent, &rcClient);
@@ -149,15 +151,13 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint)
int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->bIsDefault ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED;
if (ctl->bToolbarButton) {
- if (dat) {
- RECT rcWin;
- GetWindowRect(ctl->hwnd, &rcWin);
- POINT pt;
- pt.x = rcWin.left;
- ScreenToClient(dat->hwnd, &pt);
- BitBlt(hdcMem, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
- dat->pContainer->cachedToolbarDC, pt.x, 1, SRCCOPY);
- }
+ RECT rcWin;
+ GetWindowRect(ctl->hwnd, &rcWin);
+ POINT pt;
+ pt.x = rcWin.left;
+ ScreenToClient(dat->hwnd, &pt);
+ BitBlt(hdcMem, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
+ dat->pContainer->cachedToolbarDC, pt.x, 1, SRCCOPY);
}
if (ctl->hThemeToolbar && ctl->bIsThemed && 1 == dat->pContainer->bTBRenderingMode) {
if (bAero || PluginConfig.m_WinVerMajor >= 6)