|
@@ -1153,19 +1153,19 @@ Uint8 SDL_FindColor(const SDL_Palette *pal, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
|
return pixel;
|
|
return pixel;
|
|
}
|
|
}
|
|
|
|
|
|
-Uint8 SDL_LookupRGBAColor(SDL_HashTable *palette_map, Uint32 pixel, const SDL_Palette *pal)
|
|
|
|
|
|
+Uint8 SDL_LookupRGBAColor(SDL_HashTable *palette_map, Uint32 pixelvalue, const SDL_Palette *pal)
|
|
{
|
|
{
|
|
Uint8 color_index = 0;
|
|
Uint8 color_index = 0;
|
|
const void *value;
|
|
const void *value;
|
|
- if (SDL_FindInHashTable(palette_map, (const void *)(uintptr_t)pixel, &value)) {
|
|
|
|
|
|
+ if (SDL_FindInHashTable(palette_map, (const void *)(uintptr_t)pixelvalue, &value)) {
|
|
color_index = (Uint8)(uintptr_t)value;
|
|
color_index = (Uint8)(uintptr_t)value;
|
|
} else {
|
|
} else {
|
|
- Uint8 r = (Uint8)((pixel >> 24) & 0xFF);
|
|
|
|
- Uint8 g = (Uint8)((pixel >> 16) & 0xFF);
|
|
|
|
- Uint8 b = (Uint8)((pixel >> 8) & 0xFF);
|
|
|
|
- Uint8 a = (Uint8)((pixel >> 0) & 0xFF);
|
|
|
|
|
|
+ Uint8 r = (Uint8)((pixelvalue >> 24) & 0xFF);
|
|
|
|
+ Uint8 g = (Uint8)((pixelvalue >> 16) & 0xFF);
|
|
|
|
+ Uint8 b = (Uint8)((pixelvalue >> 8) & 0xFF);
|
|
|
|
+ Uint8 a = (Uint8)((pixelvalue >> 0) & 0xFF);
|
|
color_index = SDL_FindColor(pal, r, g, b, a);
|
|
color_index = SDL_FindColor(pal, r, g, b, a);
|
|
- SDL_InsertIntoHashTable(palette_map, (const void *)(uintptr_t)pixel, (const void *)(uintptr_t)color_index, true);
|
|
|
|
|
|
+ SDL_InsertIntoHashTable(palette_map, (const void *)(uintptr_t)pixelvalue, (const void *)(uintptr_t)color_index, true);
|
|
}
|
|
}
|
|
return color_index;
|
|
return color_index;
|
|
}
|
|
}
|
|
@@ -1274,7 +1274,7 @@ Uint32 SDL_MapRGBA(const SDL_PixelFormatDetails *format, const SDL_Palette *pale
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 *r, Uint8 *g, Uint8 *b)
|
|
|
|
|
|
+void SDL_GetRGB(Uint32 pixelvalue, const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 *r, Uint8 *g, Uint8 *b)
|
|
{
|
|
{
|
|
Uint8 unused;
|
|
Uint8 unused;
|
|
|
|
|
|
@@ -1294,10 +1294,10 @@ void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormatDetails *format, const SDL_Pa
|
|
}
|
|
}
|
|
|
|
|
|
if (SDL_ISPIXELFORMAT_INDEXED(format->format)) {
|
|
if (SDL_ISPIXELFORMAT_INDEXED(format->format)) {
|
|
- if (palette && pixel < (unsigned)palette->ncolors) {
|
|
|
|
- *r = palette->colors[pixel].r;
|
|
|
|
- *g = palette->colors[pixel].g;
|
|
|
|
- *b = palette->colors[pixel].b;
|
|
|
|
|
|
+ if (palette && pixelvalue < (unsigned)palette->ncolors) {
|
|
|
|
+ *r = palette->colors[pixelvalue].r;
|
|
|
|
+ *g = palette->colors[pixelvalue].g;
|
|
|
|
+ *b = palette->colors[pixelvalue].b;
|
|
} else {
|
|
} else {
|
|
*r = *g = *b = 0;
|
|
*r = *g = *b = 0;
|
|
}
|
|
}
|
|
@@ -1306,24 +1306,24 @@ void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormatDetails *format, const SDL_Pa
|
|
|
|
|
|
if (SDL_ISPIXELFORMAT_10BIT(format->format)) {
|
|
if (SDL_ISPIXELFORMAT_10BIT(format->format)) {
|
|
unsigned v;
|
|
unsigned v;
|
|
- v = (pixel & format->Rmask) >> format->Rshift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Rmask) >> format->Rshift;
|
|
*r = (Uint8)(v >> 2);
|
|
*r = (Uint8)(v >> 2);
|
|
- v = (pixel & format->Gmask) >> format->Gshift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Gmask) >> format->Gshift;
|
|
*g = (Uint8)(v >> 2);
|
|
*g = (Uint8)(v >> 2);
|
|
- v = (pixel & format->Bmask) >> format->Bshift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Bmask) >> format->Bshift;
|
|
*b = (Uint8)(v >> 2);
|
|
*b = (Uint8)(v >> 2);
|
|
} else {
|
|
} else {
|
|
unsigned v;
|
|
unsigned v;
|
|
- v = (pixel & format->Rmask) >> format->Rshift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Rmask) >> format->Rshift;
|
|
*r = SDL_expand_byte[format->Rbits][v];
|
|
*r = SDL_expand_byte[format->Rbits][v];
|
|
- v = (pixel & format->Gmask) >> format->Gshift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Gmask) >> format->Gshift;
|
|
*g = SDL_expand_byte[format->Gbits][v];
|
|
*g = SDL_expand_byte[format->Gbits][v];
|
|
- v = (pixel & format->Bmask) >> format->Bshift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Bmask) >> format->Bshift;
|
|
*b = SDL_expand_byte[format->Bbits][v];
|
|
*b = SDL_expand_byte[format->Bbits][v];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
|
|
|
|
|
|
+void SDL_GetRGBA(Uint32 pixelvalue, const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
|
|
{
|
|
{
|
|
Uint8 unused;
|
|
Uint8 unused;
|
|
|
|
|
|
@@ -1346,11 +1346,11 @@ void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormatDetails *format, const SDL_P
|
|
}
|
|
}
|
|
|
|
|
|
if (SDL_ISPIXELFORMAT_INDEXED(format->format)) {
|
|
if (SDL_ISPIXELFORMAT_INDEXED(format->format)) {
|
|
- if (palette && pixel < (unsigned)palette->ncolors) {
|
|
|
|
- *r = palette->colors[pixel].r;
|
|
|
|
- *g = palette->colors[pixel].g;
|
|
|
|
- *b = palette->colors[pixel].b;
|
|
|
|
- *a = palette->colors[pixel].a;
|
|
|
|
|
|
+ if (palette && pixelvalue < (unsigned)palette->ncolors) {
|
|
|
|
+ *r = palette->colors[pixelvalue].r;
|
|
|
|
+ *g = palette->colors[pixelvalue].g;
|
|
|
|
+ *b = palette->colors[pixelvalue].b;
|
|
|
|
+ *a = palette->colors[pixelvalue].a;
|
|
} else {
|
|
} else {
|
|
*r = *g = *b = *a = 0;
|
|
*r = *g = *b = *a = 0;
|
|
}
|
|
}
|
|
@@ -1359,23 +1359,23 @@ void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormatDetails *format, const SDL_P
|
|
|
|
|
|
if (SDL_ISPIXELFORMAT_10BIT(format->format)) {
|
|
if (SDL_ISPIXELFORMAT_10BIT(format->format)) {
|
|
unsigned v;
|
|
unsigned v;
|
|
- v = (pixel & format->Rmask) >> format->Rshift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Rmask) >> format->Rshift;
|
|
*r = (Uint8)(v >> 2);
|
|
*r = (Uint8)(v >> 2);
|
|
- v = (pixel & format->Gmask) >> format->Gshift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Gmask) >> format->Gshift;
|
|
*g = (Uint8)(v >> 2);
|
|
*g = (Uint8)(v >> 2);
|
|
- v = (pixel & format->Bmask) >> format->Bshift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Bmask) >> format->Bshift;
|
|
*b = (Uint8)(v >> 2);
|
|
*b = (Uint8)(v >> 2);
|
|
- v = (pixel & format->Amask) >> format->Ashift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Amask) >> format->Ashift;
|
|
*a = SDL_expand_byte[format->Abits][v];
|
|
*a = SDL_expand_byte[format->Abits][v];
|
|
} else {
|
|
} else {
|
|
unsigned v;
|
|
unsigned v;
|
|
- v = (pixel & format->Rmask) >> format->Rshift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Rmask) >> format->Rshift;
|
|
*r = SDL_expand_byte[format->Rbits][v];
|
|
*r = SDL_expand_byte[format->Rbits][v];
|
|
- v = (pixel & format->Gmask) >> format->Gshift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Gmask) >> format->Gshift;
|
|
*g = SDL_expand_byte[format->Gbits][v];
|
|
*g = SDL_expand_byte[format->Gbits][v];
|
|
- v = (pixel & format->Bmask) >> format->Bshift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Bmask) >> format->Bshift;
|
|
*b = SDL_expand_byte[format->Bbits][v];
|
|
*b = SDL_expand_byte[format->Bbits][v];
|
|
- v = (pixel & format->Amask) >> format->Ashift;
|
|
|
|
|
|
+ v = (pixelvalue & format->Amask) >> format->Ashift;
|
|
*a = SDL_expand_byte[format->Abits][v];
|
|
*a = SDL_expand_byte[format->Abits][v];
|
|
}
|
|
}
|
|
}
|
|
}
|