errr - clean clean.. fix color pixle caclfor 8bpp and 8bpp non dithered had

a.. er... bug :)


SVN revision: 4073
This commit is contained in:
Carsten Haitzler 2001-01-02 23:09:02 +00:00
parent b9aca90e0c
commit c061b76b93
3 changed files with 12 additions and 4 deletions

View File

@ -1013,6 +1013,8 @@ __imlib_LoadImage(const char *file, ImlibProgressFunction progress,
ImlibLoader *best_loader;
char loader_ret = 0;
if (!file) return NULL;
if (file[0] == 0) return NULL;
/* see if we alreayd have the image cached */
im = __imlib_FindCachedImage(file);
/* if we found a cached image and we shoudl always check that it is */

View File

@ -66,6 +66,11 @@ __imlib_RenderGetPixel(Display *d, Drawable w, Visual *v, Colormap cm, int depth
((g >> 3) & 0x1b) |
((b >> 6) & 0x02)];
break;
case 7: /* 666 */
return ct->palette[((int)(((double)r / 255) * 5.0) * 36) +
((int)(((double)g / 255) * 5.0) * 6 ) +
((int)(((double)b / 255) * 5.0) )];
break;
default:
return 0;
}

View File

@ -1,3 +1,4 @@
#include "common.h"
#ifndef X_DISPLAY_MISSING
#include <X11/Xlib.h>
@ -467,7 +468,7 @@ static DATA8 _dither_a1[8 * 8 * 256];
#ifdef WORDS_BIGENDIAN
#define WRITE2_RGBA_RGB666(src, dest) \
{ \
*((DATA16 *)dest) = (_dither_color_lut[(_dither_666r[(src[1] >> 16) & 0xff] ) + \
*((DATA32 *)dest) = (_dither_color_lut[(_dither_666r[(src[1] >> 16) & 0xff] ) + \
(_dither_666g[(src[1] >> 8 ) & 0xff] ) + \
(_dither_666b[(src[1] ) & 0xff] )]) | \
(_dither_color_lut[(_dither_666r[(src[0] >> 16) & 0xff] ) + \
@ -477,7 +478,7 @@ static DATA8 _dither_a1[8 * 8 * 256];
}
#define WRITE4_RGBA_RGB666(src, dest) \
{ \
*((DATA16 *)dest) = (_dither_color_lut[(_dither_666r[(src[3] >> 16) & 0xff] ) + \
*((DATA32 *)dest) = (_dither_color_lut[(_dither_666r[(src[3] >> 16) & 0xff] ) + \
(_dither_666g[(src[3] >> 8 ) & 0xff] ) + \
(_dither_666b[(src[3] ) & 0xff] )]) | \
(_dither_color_lut[(_dither_666r[(src[2] >> 16) & 0xff] ) + \
@ -494,7 +495,7 @@ static DATA8 _dither_a1[8 * 8 * 256];
#else
#define WRITE2_RGBA_RGB666(src, dest) \
{ \
*((DATA16 *)dest) = (_dither_color_lut[(_dither_666r[(src[0] >> 16) & 0xff] ) + \
*((DATA32 *)dest) = (_dither_color_lut[(_dither_666r[(src[0] >> 16) & 0xff] ) + \
(_dither_666g[(src[0] >> 8 ) & 0xff] ) + \
(_dither_666b[(src[0] ) & 0xff] )]) | \
(_dither_color_lut[(_dither_666r[(src[1] >> 16) & 0xff] ) + \
@ -504,7 +505,7 @@ static DATA8 _dither_a1[8 * 8 * 256];
}
#define WRITE4_RGBA_RGB666(src, dest) \
{ \
*((DATA16 *)dest) = (_dither_color_lut[(_dither_666r[(src[0] >> 16) & 0xff] ) + \
*((DATA32 *)dest) = (_dither_color_lut[(_dither_666r[(src[0] >> 16) & 0xff] ) + \
(_dither_666g[(src[0] >> 8 ) & 0xff] ) + \
(_dither_666b[(src[0] ) & 0xff] )]) | \
(_dither_color_lut[(_dither_666r[(src[1] >> 16) & 0xff] ) + \