summaryrefslogtreecommitdiff
path: root/ui/tray_icon.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:08:42 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:08:42 +0200
commitc32707148292d104c66276b43796d6057c8c7a5d (patch)
treebb83513f4aff24153e21a4ec92e34e4c27651b1f /ui/tray_icon.cpp
parent3.9 (diff)
downloadFreeFileSync-c32707148292d104c66276b43796d6057c8c7a5d.tar.gz
FreeFileSync-c32707148292d104c66276b43796d6057c8c7a5d.tar.bz2
FreeFileSync-c32707148292d104c66276b43796d6057c8c7a5d.zip
3.10
Diffstat (limited to 'ui/tray_icon.cpp')
-rw-r--r--ui/tray_icon.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/ui/tray_icon.cpp b/ui/tray_icon.cpp
index 464bf7ef..71de676d 100644
--- a/ui/tray_icon.cpp
+++ b/ui/tray_icon.cpp
@@ -24,7 +24,7 @@ int roundNum(double d) //little rounding function
wxIcon generateIcon(size_t percent) //generate icon with progress indicator
{
- percent = std::min(percent, static_cast<size_t>(100u)); //handle invalid input
+ percent = std::min(percent, static_cast<size_t>(100)); //handle invalid input
#ifdef FFS_WIN
static const wxBitmap trayIcon = GlobalResources::getInstance().getImageByName(wxT("FFS_tray_win.png"));
@@ -39,25 +39,26 @@ wxIcon generateIcon(size_t percent) //generate icon with progress indicator
if (buffer.first == indicatorHeight)
return buffer.second;
- if ( trayIcon.GetWidth() > 0 &&
- trayIcon.GetHeight() > 0)
- {
- static const int indicatorWidth = trayIcon.GetWidth() * .25;
- const int indicatorXBegin = ceil((trayIcon.GetWidth() - indicatorWidth) / 2.0);
- const int indicatorYBegin = trayIcon.GetHeight() - indicatorHeight;
-
wxImage genImage(trayIcon.ConvertToImage());
+ if ( genImage.GetWidth() > 0 &&
+ genImage.GetHeight() > 0)
+ {
+ const int indicatorWidth = genImage.GetWidth() * .4;
+ const int indicatorXBegin = std::ceil((genImage.GetWidth() - indicatorWidth) / 2.0);
+ const int indicatorYBegin = genImage.GetHeight() - indicatorHeight;
+
//draw progress indicator: do NOT use wxDC::DrawRectangle! Doesn't respect alpha in Windows, but does in Linux!
//We need a simple, working solution:
unsigned char* const data = genImage.GetData();
+
for (int row = indicatorYBegin; row < genImage.GetHeight(); ++row)
{
for (int col = indicatorXBegin; col < indicatorXBegin + indicatorWidth; ++col)
{
unsigned char* const pixelBegin = data + (row * genImage.GetWidth() + col) * 3;
- pixelBegin[0] = 255; //red
- pixelBegin[1] = 255; //green
+ pixelBegin[0] = 240; //red
+ pixelBegin[1] = 200; //green
pixelBegin[2] = 0; //blue
}
}
bgstack15