diff -Naur Irrlicht.old/jpeglib/rdtarga.c Irrlicht/jpeglib/rdtarga.c --- Irrlicht.old/jpeglib/rdtarga.c 2005-03-01 14:43:47.819176627 +0100 +++ Irrlicht/jpeglib/rdtarga.c 2005-03-09 10:18:54.000000000 +0100 @@ -219,18 +219,8 @@ ptr = source->pub.buffer[0]; for (col = cinfo->image_width; col > 0; col--) { (*source->read_pixel) (source); /* Load next pixel into tga_pixel */ - t = UCH(source->tga_pixel[0]); - t += UCH(source->tga_pixel[1]) << 8; - /* We expand 5 bit data to 8 bit sample width. - * The format of the 16-bit (LSB first) input word is - * xRRRRRGGGGGBBBBB - */ - ptr[2] = (JSAMPLE) c5to8bits[t & 0x1F]; - t >>= 5; - ptr[1] = (JSAMPLE) c5to8bits[t & 0x1F]; - t >>= 5; - ptr[0] = (JSAMPLE) c5to8bits[t & 0x1F]; - ptr += 3; + *ptr++ = (JSAMPLE) UCH(source->tga_pixel[1]); + *ptr++ = (JSAMPLE) UCH(source->tga_pixel[0]); } return 1; } @@ -260,7 +250,24 @@ * This works because the actual pixel length is only known to read_pixel. */ -#define get_32bit_row get_24bit_row +METHODDEF(JDIMENSION) +get_32bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) +/* This version is for reading 32-bit pixels */ +{ + tga_source_ptr source = (tga_source_ptr) sinfo; + register JSAMPROW ptr; + register JDIMENSION col; + + ptr = source->pub.buffer[0]; + for (col = cinfo->image_width; col > 0; col--) { + (*source->read_pixel) (source); /* Load next pixel into tga_pixel */ + *ptr++ = (JSAMPLE) UCH(source->tga_pixel[3]); /* change BGR to RGB order */ + *ptr++ = (JSAMPLE) UCH(source->tga_pixel[2]); + *ptr++ = (JSAMPLE) UCH(source->tga_pixel[1]); + *ptr++ = (JSAMPLE) UCH(source->tga_pixel[0]); + } + return 1; +} /* @@ -389,6 +396,7 @@ TRACEMS2(cinfo, 1, JTRC_TGA_MAPPED, width, height); break; case 2: /* RGB image */ + components = source->pixel_size; switch (source->pixel_size) { case 2: source->get_pixel_rows = get_16bit_row;