+
+ case READPNG_320_24:
+ case READPNG_480_24:
+ {
+ int height, width, h;
+ int needw = (what == READPNG_480_24) ? 480 : 320;
+ unsigned char *dst = dest;
+ if (info_ptr->pixel_depth != 24)
+ {
+ lprintf(__FILE__ ": image uses %ibpp, needed 24bpp\n", info_ptr->pixel_depth);
+ break;
+ }
+ height = info_ptr->height;
+ if (height > 240) height = 240;
+ width = info_ptr->width;
+ if (width > needw) width = needw;
+
+ for (h = 0; h < height; h++)
+ {
+ int len = width;
+ unsigned char *src = row_ptr[h];
+ dst += (needw - width) * 3;
+ for (len = width; len > 0; len--, dst+=3, src+=3)
+ dst[0] = src[2], dst[1] = src[1], dst[2] = src[0];
+ }
+ break;
+ }