Fri Aug 20 15:21:51 PDT 1999 Michael Jennings <mej@eterm.org>

Damn!  No wonder it's been so fscking slow.  Okay, folks, try
	some shaded transparency now.  I'll bet you'll notice a speed
	difference. :-)


SVN revision: 65
This commit is contained in:
Michael Jennings 1999-08-20 22:22:59 +00:00
parent b89ca88e52
commit b5a445f9da
2 changed files with 20 additions and 13 deletions

View File

@ -2309,3 +2309,10 @@ Fri Aug 20 13:23:44 PDT 1999 Michael Jennings <mej@eterm.org>
know why some of those menus seemed unnecessarily wide. know why some of those menus seemed unnecessarily wide.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Fri Aug 20 15:21:51 PDT 1999 Michael Jennings <mej@eterm.org>
Damn! No wonder it's been so fscking slow. Okay, folks, try
some shaded transparency now. I'll bet you'll notice a speed
difference. :-)
-------------------------------------------------------------------------------

View File

@ -840,7 +840,7 @@ colormod_trans(Pixmap p, GC gc, unsigned short w, unsigned short h)
register unsigned long v, i; register unsigned long v, i;
unsigned long x, y; unsigned long x, y;
unsigned int r, g, b; unsigned int r, g, b;
float rm, gm, bm, shade; unsigned short rm, gm, bm, shade;
ImlibColor ctab[256]; ImlibColor ctab[256];
int real_depth = 0; int real_depth = 0;
register int br, bg, bb; register int br, bg, bb;
@ -848,27 +848,27 @@ colormod_trans(Pixmap p, GC gc, unsigned short w, unsigned short h)
imlib_t *iml = images[image_bg].current->iml; imlib_t *iml = images[image_bg].current->iml;
if (iml->mod) { if (iml->mod) {
shade = (float) (iml->mod->brightness / 255.0); shade = iml->mod->brightness;
} else { } else {
shade = 1.0; shade = 256;
} }
if (iml->rmod) { if (iml->rmod) {
rm = (float) (iml->rmod->brightness) / 255.0 * shade; rm = (iml->rmod->brightness * shade) >> 8;
} else { } else {
rm = shade; rm = shade;
} }
if (iml->gmod) { if (iml->gmod) {
gm = (float) (iml->gmod->brightness) / 255.0 * shade; gm = (iml->gmod->brightness * shade) >> 8;
} else { } else {
gm = shade; gm = shade;
} }
if (iml->bmod) { if (iml->bmod) {
bm = (float) (iml->bmod->brightness) / 255.0 * shade; bm = (iml->bmod->brightness * shade) >> 8;
} else { } else {
bm = shade; bm = shade;
} }
if (shade == 1.0 && rm == 1.0 && gm == 1.0 && bm == 1.0) { if (rm == 256 && gm == 256 && bm == 256) {
return; /* Nothing to do */ return; /* Nothing to do */
} }
if (Xdepth <= 8) { if (Xdepth <= 8) {
@ -908,9 +908,9 @@ colormod_trans(Pixmap p, GC gc, unsigned short w, unsigned short h)
for (y = 0; y < h; y++) { for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) { for (x = 0; x < w; x++) {
v = XGetPixel(ximg, x, y); v = XGetPixel(ximg, x, y);
r = (int) ctab[v & 0xff].r * rm; r = (ctab[v & 0xff].r * rm) >> 8;
g = (int) ctab[v & 0xff].g * gm; g = (ctab[v & 0xff].g * gm) >> 8;
b = (int) ctab[v & 0xff].b * bm; b = (ctab[v & 0xff].b * bm) >> 8;
v = Imlib_best_color_match(imlib_id, &r, &g, &b); v = Imlib_best_color_match(imlib_id, &r, &g, &b);
XPutPixel(ximg, x, y, v); XPutPixel(ximg, x, y, v);
} }
@ -945,9 +945,9 @@ colormod_trans(Pixmap p, GC gc, unsigned short w, unsigned short h)
for (y = 0; y < h; y++) { for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) { for (x = 0; x < w; x++) {
v = XGetPixel(ximg, x, y); v = XGetPixel(ximg, x, y);
r = (int) (((v >> br) & mr) * rm) & 0xff; r = ((((v >> br) & mr) * rm) >> 8) & 0xff;
g = (int) (((v >> bg) & mg) * gm) & 0xff; g = ((((v >> bg) & mg) * gm) >> 8) & 0xff;
b = (int) (((v << bb) & mb) * bm) & 0xff; b = ((((v << bb) & mb) * bm) >> 8) & 0xff;
v = ((r & mr) << br) | ((g & mg) << bg) | ((b & mb) >> bb); v = ((r & mr) << br) | ((g & mg) << bg) | ((b & mb) >> bb);
XPutPixel(ximg, x, y, v); XPutPixel(ximg, x, y, v);
} }