Index: jdcolext.c |
=================================================================== |
--- jdcolext.c (revision 134206) |
+++ jdcolext.c (working copy) |
@@ -102,3 +102,40 @@ |
} |
} |
} |
+ |
+ |
+/* |
+ * Convert RGB to extended RGB: just swap the order of source pixels |
+ */ |
+ |
+INLINE |
+LOCAL(void) |
+rgb_rgb_convert_internal (j_decompress_ptr cinfo, |
+ JSAMPIMAGE input_buf, JDIMENSION input_row, |
+ JSAMPARRAY output_buf, int num_rows) |
+{ |
+ register JSAMPROW inptr0, inptr1, inptr2; |
+ register JSAMPROW outptr; |
+ register JDIMENSION col; |
+ JDIMENSION num_cols = cinfo->output_width; |
+ |
+ while (--num_rows >= 0) { |
+ inptr0 = input_buf[0][input_row]; |
+ inptr1 = input_buf[1][input_row]; |
+ inptr2 = input_buf[2][input_row]; |
+ input_row++; |
+ outptr = *output_buf++; |
+ for (col = 0; col < num_cols; col++) { |
+ /* We can dispense with GETJSAMPLE() here */ |
+ outptr[RGB_RED] = inptr0[col]; |
+ outptr[RGB_GREEN] = inptr1[col]; |
+ outptr[RGB_BLUE] = inptr2[col]; |
+ /* Set unused byte to 0xFF so it can be interpreted as an opaque */ |
+ /* alpha channel value */ |
+#ifdef RGB_ALPHA |
+ outptr[RGB_ALPHA] = 0xFF; |
+#endif |
+ outptr += RGB_PIXELSIZE; |
+ } |
+ } |
+} |