OLD | NEW |
1 /* | 1 /* |
2 * jdcolext.c | 2 * jdcolext.c |
3 * | 3 * |
4 * Copyright (C) 1991-1997, Thomas G. Lane. | 4 * Copyright (C) 1991-1997, Thomas G. Lane. |
5 * Copyright (C) 2009, 2011, D. R. Commander. | 5 * Copyright (C) 2009, 2011, D. R. Commander. |
6 * This file is part of the Independent JPEG Group's software. | 6 * This file is part of the Independent JPEG Group's software. |
7 * For conditions of distribution and use, see the accompanying README file. | 7 * For conditions of distribution and use, see the accompanying README file. |
8 * | 8 * |
9 * This file contains output colorspace conversion routines. | 9 * This file contains output colorspace conversion routines. |
10 */ | 10 */ |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col]; | 95 outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col]; |
96 /* Set unused byte to 0xFF so it can be interpreted as an opaque */ | 96 /* Set unused byte to 0xFF so it can be interpreted as an opaque */ |
97 /* alpha channel value */ | 97 /* alpha channel value */ |
98 #ifdef RGB_ALPHA | 98 #ifdef RGB_ALPHA |
99 outptr[RGB_ALPHA] = 0xFF; | 99 outptr[RGB_ALPHA] = 0xFF; |
100 #endif | 100 #endif |
101 outptr += RGB_PIXELSIZE; | 101 outptr += RGB_PIXELSIZE; |
102 } | 102 } |
103 } | 103 } |
104 } | 104 } |
| 105 |
| 106 |
| 107 /* |
| 108 * Convert RGB to extended RGB: just swap the order of source pixels |
| 109 */ |
| 110 |
| 111 INLINE |
| 112 LOCAL(void) |
| 113 rgb_rgb_convert_internal (j_decompress_ptr cinfo, |
| 114 JSAMPIMAGE input_buf, JDIMENSION input_row, |
| 115 JSAMPARRAY output_buf, int num_rows) |
| 116 { |
| 117 register JSAMPROW inptr0, inptr1, inptr2; |
| 118 register JSAMPROW outptr; |
| 119 register JDIMENSION col; |
| 120 JDIMENSION num_cols = cinfo->output_width; |
| 121 |
| 122 while (--num_rows >= 0) { |
| 123 inptr0 = input_buf[0][input_row]; |
| 124 inptr1 = input_buf[1][input_row]; |
| 125 inptr2 = input_buf[2][input_row]; |
| 126 input_row++; |
| 127 outptr = *output_buf++; |
| 128 for (col = 0; col < num_cols; col++) { |
| 129 /* We can dispense with GETJSAMPLE() here */ |
| 130 outptr[RGB_RED] = inptr0[col]; |
| 131 outptr[RGB_GREEN] = inptr1[col]; |
| 132 outptr[RGB_BLUE] = inptr2[col]; |
| 133 /* Set unused byte to 0xFF so it can be interpreted as an opaque */ |
| 134 /* alpha channel value */ |
| 135 #ifdef RGB_ALPHA |
| 136 outptr[RGB_ALPHA] = 0xFF; |
| 137 #endif |
| 138 outptr += RGB_PIXELSIZE; |
| 139 } |
| 140 } |
| 141 } |
OLD | NEW |