forked from old/legacy-imlib2
errr - clean clean.. fix color pixle caclfor 8bpp and 8bpp non dithered had
a.. er... bug :) SVN revision: 4073
This commit is contained in:
parent
b9aca90e0c
commit
c061b76b93
|
@ -1013,6 +1013,8 @@ __imlib_LoadImage(const char *file, ImlibProgressFunction progress,
|
||||||
ImlibLoader *best_loader;
|
ImlibLoader *best_loader;
|
||||||
char loader_ret = 0;
|
char loader_ret = 0;
|
||||||
|
|
||||||
|
if (!file) return NULL;
|
||||||
|
if (file[0] == 0) return NULL;
|
||||||
/* see if we alreayd have the image cached */
|
/* see if we alreayd have the image cached */
|
||||||
im = __imlib_FindCachedImage(file);
|
im = __imlib_FindCachedImage(file);
|
||||||
/* if we found a cached image and we shoudl always check that it is */
|
/* if we found a cached image and we shoudl always check that it is */
|
||||||
|
|
|
@ -66,6 +66,11 @@ __imlib_RenderGetPixel(Display *d, Drawable w, Visual *v, Colormap cm, int depth
|
||||||
((g >> 3) & 0x1b) |
|
((g >> 3) & 0x1b) |
|
||||||
((b >> 6) & 0x02)];
|
((b >> 6) & 0x02)];
|
||||||
break;
|
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:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#ifndef X_DISPLAY_MISSING
|
#ifndef X_DISPLAY_MISSING
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
@ -467,7 +468,7 @@ static DATA8 _dither_a1[8 * 8 * 256];
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
#define WRITE2_RGBA_RGB666(src, dest) \
|
#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_666g[(src[1] >> 8 ) & 0xff] ) + \
|
||||||
(_dither_666b[(src[1] ) & 0xff] )]) | \
|
(_dither_666b[(src[1] ) & 0xff] )]) | \
|
||||||
(_dither_color_lut[(_dither_666r[(src[0] >> 16) & 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) \
|
#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_666g[(src[3] >> 8 ) & 0xff] ) + \
|
||||||
(_dither_666b[(src[3] ) & 0xff] )]) | \
|
(_dither_666b[(src[3] ) & 0xff] )]) | \
|
||||||
(_dither_color_lut[(_dither_666r[(src[2] >> 16) & 0xff] ) + \
|
(_dither_color_lut[(_dither_666r[(src[2] >> 16) & 0xff] ) + \
|
||||||
|
@ -494,7 +495,7 @@ static DATA8 _dither_a1[8 * 8 * 256];
|
||||||
#else
|
#else
|
||||||
#define WRITE2_RGBA_RGB666(src, dest) \
|
#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_666g[(src[0] >> 8 ) & 0xff] ) + \
|
||||||
(_dither_666b[(src[0] ) & 0xff] )]) | \
|
(_dither_666b[(src[0] ) & 0xff] )]) | \
|
||||||
(_dither_color_lut[(_dither_666r[(src[1] >> 16) & 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) \
|
#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_666g[(src[0] >> 8 ) & 0xff] ) + \
|
||||||
(_dither_666b[(src[0] ) & 0xff] )]) | \
|
(_dither_666b[(src[0] ) & 0xff] )]) | \
|
||||||
(_dither_color_lut[(_dither_666r[(src[1] >> 16) & 0xff] ) + \
|
(_dither_color_lut[(_dither_666r[(src[1] >> 16) & 0xff] ) + \
|
||||||
|
|
Loading…
Reference in New Issue