lower cpu use with icon. replace HUE by ALPHA on icon (see task_icon_asb).

git-svn-id: http://tint2.googlecode.com/svn/trunk@187 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
lorthiois@bbsoft.fr
2009-09-19 20:56:15 +00:00
parent ef0d7ac586
commit b3e399b3d2
6 changed files with 80 additions and 120 deletions

View File

@@ -30,7 +30,7 @@
void adjust_hsb(DATA32 *data, int w, int h, float hu, float satur, float bright)
void adjust_asb(DATA32 *data, int w, int h, int alpha, float satur, float bright)
{
unsigned int x, y;
unsigned int a, r, g, b, argb;
@@ -44,6 +44,8 @@ void adjust_hsb(DATA32 *data, int w, int h, float hu, float satur, float bright)
for(id = y * w, x = 0; x < w; x++, id++) {
argb = data[id];
a = (argb >> 24) & 0xff;
// transparent => nothing to do.
if (a == 0) continue;
r = (argb >> 16) & 0xff;
g = (argb >> 8) & 0xff;
b = (argb) & 0xff;
@@ -82,9 +84,8 @@ void adjust_hsb(DATA32 *data, int w, int h, float hu, float satur, float bright)
brightness += bright;
if (brightness < 0.0) brightness = 0.0;
if (brightness > 1.0) brightness = 1.0;
hue += hu;
if (hue < 0.0) hue = 0.0;
if (hue > 1.0) hue = 1.0;
if (alpha != 100)
a = (a * alpha)/100;
// convert HSB to RGB
if (saturation == 0) {
@@ -138,4 +139,3 @@ void adjust_hsb(DATA32 *data, int w, int h, float hu, float satur, float bright)
}
}

View File

@@ -50,9 +50,9 @@ typedef struct config_color
} config_color;
// adjust HSB on an ARGB icon
void adjust_hsb(DATA32 *data, int w, int h, float hue, float satur, float bright);
// adjust Alpha/Saturation/Brightness on an ARGB icon
// 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);
#endif