+
+ case READPNG_24:
+ {
+ int height, width, h;
+ 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 > req_h)
+ height = req_h;
+ width = info_ptr->width;
+ if (width > req_w)
+ width = req_w;
+
+ for (h = 0; h < height; h++)
+ {
+ int len = width;
+ unsigned char *src = row_ptr[h];
+ dst += (req_w - 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;
+ }