systray: reorder operations to prevent the long icon first show delay that occurs sometimes

This commit is contained in:
o9000
2015-06-14 10:51:30 +02:00
parent 1ba023fc83
commit f5b2de62b6
3 changed files with 75 additions and 64 deletions

View File

@@ -362,6 +362,37 @@ void createHeuristicMask(DATA32* data, int w, int h)
}
}
int pixelEmpty(DATA32 argb)
{
DATA32 a = (argb >> 24) & 0xff;
if (a == 0)
return 1;
DATA32 rgb = argb & 0xffFFff;
return rgb == 0;
}
int imageEmpty(DATA32* data, int w, int h)
{
unsigned int x, y;
if (w > 0 && h > 0) {
x = w / 2;
y = h / 2;
if (!pixelEmpty(data[y * w + x]))
return 0;
}
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
if (!pixelEmpty(data[y * w + x]))
return 0;
}
}
return 1;
}
void render_image(Drawable d, int x, int y)
{

View File

@@ -62,6 +62,7 @@ void extract_values (const char *value, char **value1, char **value2, char **val
// alpha from 0 to 100, satur from 0 to 1, bright from 0 to 1.
void adjust_asb(DATA32 *data, int w, int h, int alpha, float satur, float bright);
void createHeuristicMask(DATA32* data, int w, int h);
int imageEmpty(DATA32* data, int w, int h);
void render_image(Drawable d, int x, int y);