Rev 4678 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4678 | Rev 4688 | ||
---|---|---|---|
Line 143... | Line 143... | ||
143 | ((uint8_t *) dst)[0] = BLUE(rgb, 8); |
143 | ((uint8_t *) dst)[0] = BLUE(rgb, 8); |
144 | ((uint8_t *) dst)[1] = GREEN(rgb, 8); |
144 | ((uint8_t *) dst)[1] = GREEN(rgb, 8); |
145 | ((uint8_t *) dst)[2] = RED(rgb, 8); |
145 | ((uint8_t *) dst)[2] = RED(rgb, 8); |
146 | } |
146 | } |
147 | 147 | ||
148 | static void bgr_555(void *dst, uint32_t rgb) |
148 | static void rgb_555_be(void *dst, uint32_t rgb) |
149 | { |
149 | { |
150 | uint8_t hi = (BLUE(rgb, 5) | (GREEN(rgb, 5) << 5)) & 0xff; |
150 | *((uint16_t *) dst) = host2uint16_t_be(RED(rgb, 5) << 10 | |
151 | uint8_t lo = (GREEN(rgb, 5) >> 3) | (RED(rgb, 5) << 2); |
151 | GREEN(rgb, 5) << 5 | BLUE(rgb, 5)); |
152 | *((uint16_t *) dst) = host2uint16_t_be((hi << 8) | lo); |
- | |
153 | } |
152 | } |
154 | 153 | ||
155 | static void bgr_565(void *dst, uint32_t rgb) |
154 | static void rgb_555_le(void *dst, uint32_t rgb) |
156 | { |
155 | { |
- | 156 | *((uint16_t *) dst) = host2uint16_t_le(RED(rgb, 5) << 10 | |
|
- | 157 | GREEN(rgb, 5) << 5 | BLUE(rgb, 5)); |
|
- | 158 | } |
|
- | 159 | ||
- | 160 | static void rgb_565_be(void *dst, uint32_t rgb) |
|
- | 161 | { |
|
157 | uint8_t hi = (BLUE(rgb, 5) | (GREEN(rgb, 6) << 5)) & 0xff; |
162 | *((uint16_t *) dst) = host2uint16_t_be(RED(rgb, 5) << 11 | |
158 | uint8_t lo = (GREEN(rgb, 6) >> 3) | (RED(rgb, 5) << 3); |
163 | GREEN(rgb, 6) << 5 | BLUE(rgb, 5)); |
- | 164 | } |
|
- | 165 | ||
- | 166 | static void rgb_565_le(void *dst, uint32_t rgb) |
|
- | 167 | { |
|
159 | *((uint16_t *) dst) = host2uint16_t_be((hi << 8) | lo); |
168 | *((uint16_t *) dst) = host2uint16_t_le(RED(rgb, 5) << 11 | |
- | 169 | GREEN(rgb, 6) << 5 | BLUE(rgb, 5)); |
|
160 | } |
170 | } |
161 | 171 | ||
162 | 172 | ||
163 | /** BGR 3:2:3 |
173 | /** BGR 3:2:3 |
164 | * |
174 | * |
Line 452... | Line 462... | ||
452 | switch (props->visual) { |
462 | switch (props->visual) { |
453 | case VISUAL_INDIRECT_8: |
463 | case VISUAL_INDIRECT_8: |
454 | rgb_conv = bgr_323; |
464 | rgb_conv = bgr_323; |
455 | pixelbytes = 1; |
465 | pixelbytes = 1; |
456 | break; |
466 | break; |
457 | case VISUAL_BGR_5_5_5: |
467 | case VISUAL_RGB_5_5_5_LE: |
- | 468 | rgb_conv = rgb_555_le; |
|
- | 469 | pixelbytes = 2; |
|
- | 470 | break; |
|
- | 471 | case VISUAL_RGB_5_5_5_BE: |
|
458 | rgb_conv = bgr_555; |
472 | rgb_conv = rgb_555_be; |
- | 473 | pixelbytes = 2; |
|
- | 474 | break; |
|
- | 475 | case VISUAL_RGB_5_6_5_LE: |
|
- | 476 | rgb_conv = rgb_565_le; |
|
459 | pixelbytes = 2; |
477 | pixelbytes = 2; |
460 | break; |
478 | break; |
461 | case VISUAL_BGR_5_6_5: |
479 | case VISUAL_RGB_5_6_5_BE: |
462 | rgb_conv = bgr_565; |
480 | rgb_conv = rgb_565_be; |
463 | pixelbytes = 2; |
481 | pixelbytes = 2; |
464 | break; |
482 | break; |
465 | case VISUAL_RGB_8_8_8: |
483 | case VISUAL_RGB_8_8_8: |
466 | rgb_conv = rgb_888; |
484 | rgb_conv = rgb_888; |
467 | pixelbytes = 3; |
485 | pixelbytes = 3; |