Commit f57c4076 authored by Cyril Deguet's avatar Cyril Deguet

* sdl_image.c: fixed 8bpp too

parent 5b3632af
...@@ -175,25 +175,21 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -175,25 +175,21 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
case 8: case 8:
{ {
int i, j; int i, j;
uint8_t *r = p_pic->p[0].p_pixels; uint8_t *p_src, *p_dst;
uint8_t *g = p_pic->p[0].p_pixels + 1; uint8_t r, g, b;
uint8_t *b = p_pic->p[0].p_pixels + 2;
SDL_Palette *p_palette = p_surface->format->palette;
for ( i = 0; i < p_surface->h; i++ ) for ( i = 0; i < p_surface->h; i++ )
{ {
p_src = p_surface->pixels + i * p_surface->pitch;
p_dst = p_pic->p[0].p_pixels + i * p_pic->p[0].i_pitch;
for ( j = 0; j < p_surface->w; j++ ) for ( j = 0; j < p_surface->w; j++ )
{ {
uint8_t i_index = ((uint8_t *)p_surface->pixels)[j]; SDL_GetRGB( *(p_src++), p_surface->format,
SDL_Color *p_color = &p_palette->colors[i_index]; &r, &g, &b );
r[j] = p_color->r; *(p_dst++) = r;
g[j] = p_color->g; *(p_dst++) = g;
b[j] = p_color->b; *(p_dst++) = b;
} }
} }
r += p_pic->p[0].i_pitch;
g += p_pic->p[0].i_pitch;
b += p_pic->p[0].i_pitch;
break; break;
} }
case 16: case 16:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment