2007-09-16 23:08:06 +02:00
|
|
|
/*
|
2006-02-06 05:11:15 +01:00
|
|
|
* Arm PrimeCell PL110 Color LCD Controller
|
|
|
|
*
|
|
|
|
* Copyright (c) 2005 CodeSourcery, LLC.
|
|
|
|
* Written by Paul Brook
|
|
|
|
*
|
2011-06-26 04:21:35 +02:00
|
|
|
* This code is licensed under the GNU LGPL
|
2006-02-06 05:11:15 +01:00
|
|
|
*
|
|
|
|
* Framebuffer format conversion routines.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ORDER
|
|
|
|
|
|
|
|
#if BITS == 8
|
|
|
|
#define COPY_PIXEL(to, from) *(to++) = from
|
|
|
|
#elif BITS == 15 || BITS == 16
|
2014-01-31 15:47:33 +01:00
|
|
|
#define COPY_PIXEL(to, from) do { *(uint16_t *)to = from; to += 2; } while (0)
|
2007-09-16 23:08:06 +02:00
|
|
|
#elif BITS == 24
|
2014-01-31 15:47:33 +01:00
|
|
|
#define COPY_PIXEL(to, from) \
|
|
|
|
do { \
|
|
|
|
*(to++) = from; \
|
|
|
|
*(to++) = (from) >> 8; \
|
|
|
|
*(to++) = (from) >> 16; \
|
|
|
|
} while (0)
|
2006-02-06 05:11:15 +01:00
|
|
|
#elif BITS == 32
|
2014-01-31 15:47:33 +01:00
|
|
|
#define COPY_PIXEL(to, from) do { *(uint32_t *)to = from; to += 4; } while (0)
|
2006-02-06 05:11:15 +01:00
|
|
|
#else
|
|
|
|
#error unknown bit depth
|
|
|
|
#endif
|
|
|
|
|
2007-10-05 01:45:31 +02:00
|
|
|
#undef RGB
|
|
|
|
#define BORDER bgr
|
2006-02-06 05:11:15 +01:00
|
|
|
#define ORDER 0
|
2013-03-18 17:36:02 +01:00
|
|
|
#include "pl110_template.h"
|
2006-02-06 05:11:15 +01:00
|
|
|
#define ORDER 1
|
2013-03-18 17:36:02 +01:00
|
|
|
#include "pl110_template.h"
|
2006-02-06 05:11:15 +01:00
|
|
|
#define ORDER 2
|
2013-03-18 17:36:02 +01:00
|
|
|
#include "pl110_template.h"
|
2007-10-05 01:45:31 +02:00
|
|
|
#undef BORDER
|
|
|
|
#define RGB
|
|
|
|
#define BORDER rgb
|
|
|
|
#define ORDER 0
|
2013-03-18 17:36:02 +01:00
|
|
|
#include "pl110_template.h"
|
2007-10-05 01:45:31 +02:00
|
|
|
#define ORDER 1
|
2013-03-18 17:36:02 +01:00
|
|
|
#include "pl110_template.h"
|
2007-10-05 01:45:31 +02:00
|
|
|
#define ORDER 2
|
2013-03-18 17:36:02 +01:00
|
|
|
#include "pl110_template.h"
|
2007-10-05 01:45:31 +02:00
|
|
|
#undef BORDER
|
2006-02-06 05:11:15 +01:00
|
|
|
|
2011-07-22 15:19:33 +02:00
|
|
|
static drawfn glue(pl110_draw_fn_,BITS)[48] =
|
2006-02-06 05:11:15 +01:00
|
|
|
{
|
2007-10-05 01:45:31 +02:00
|
|
|
glue(pl110_draw_line1_lblp_bgr,BITS),
|
|
|
|
glue(pl110_draw_line2_lblp_bgr,BITS),
|
|
|
|
glue(pl110_draw_line4_lblp_bgr,BITS),
|
|
|
|
glue(pl110_draw_line8_lblp_bgr,BITS),
|
2011-07-22 15:19:33 +02:00
|
|
|
glue(pl110_draw_line16_555_lblp_bgr,BITS),
|
2007-10-05 01:45:31 +02:00
|
|
|
glue(pl110_draw_line32_lblp_bgr,BITS),
|
2011-07-22 15:19:33 +02:00
|
|
|
glue(pl110_draw_line16_lblp_bgr,BITS),
|
|
|
|
glue(pl110_draw_line12_lblp_bgr,BITS),
|
2007-10-05 01:45:31 +02:00
|
|
|
|
|
|
|
glue(pl110_draw_line1_bbbp_bgr,BITS),
|
|
|
|
glue(pl110_draw_line2_bbbp_bgr,BITS),
|
|
|
|
glue(pl110_draw_line4_bbbp_bgr,BITS),
|
|
|
|
glue(pl110_draw_line8_bbbp_bgr,BITS),
|
2011-07-22 15:19:33 +02:00
|
|
|
glue(pl110_draw_line16_555_bbbp_bgr,BITS),
|
2007-10-05 01:45:31 +02:00
|
|
|
glue(pl110_draw_line32_bbbp_bgr,BITS),
|
2011-07-22 15:19:33 +02:00
|
|
|
glue(pl110_draw_line16_bbbp_bgr,BITS),
|
|
|
|
glue(pl110_draw_line12_bbbp_bgr,BITS),
|
2007-10-05 01:45:31 +02:00
|
|
|
|
|
|
|
glue(pl110_draw_line1_lbbp_bgr,BITS),
|
|
|
|
glue(pl110_draw_line2_lbbp_bgr,BITS),
|
|
|
|
glue(pl110_draw_line4_lbbp_bgr,BITS),
|
|
|
|
glue(pl110_draw_line8_lbbp_bgr,BITS),
|
2011-07-22 15:19:33 +02:00
|
|
|
glue(pl110_draw_line16_555_lbbp_bgr,BITS),
|
2007-10-05 01:45:31 +02:00
|
|
|
glue(pl110_draw_line32_lbbp_bgr,BITS),
|
2011-07-22 15:19:33 +02:00
|
|
|
glue(pl110_draw_line16_lbbp_bgr,BITS),
|
|
|
|
glue(pl110_draw_line12_lbbp_bgr,BITS),
|
2007-10-05 01:45:31 +02:00
|
|
|
|
|
|
|
glue(pl110_draw_line1_lblp_rgb,BITS),
|
|
|
|
glue(pl110_draw_line2_lblp_rgb,BITS),
|
|
|
|
glue(pl110_draw_line4_lblp_rgb,BITS),
|
|
|
|
glue(pl110_draw_line8_lblp_rgb,BITS),
|
2011-07-22 15:19:33 +02:00
|
|
|
glue(pl110_draw_line16_555_lblp_rgb,BITS),
|
2007-10-05 01:45:31 +02:00
|
|
|
glue(pl110_draw_line32_lblp_rgb,BITS),
|
2011-07-22 15:19:33 +02:00
|
|
|
glue(pl110_draw_line16_lblp_rgb,BITS),
|
|
|
|
glue(pl110_draw_line12_lblp_rgb,BITS),
|
2007-10-05 01:45:31 +02:00
|
|
|
|
|
|
|
glue(pl110_draw_line1_bbbp_rgb,BITS),
|
|
|
|
glue(pl110_draw_line2_bbbp_rgb,BITS),
|
|
|
|
glue(pl110_draw_line4_bbbp_rgb,BITS),
|
|
|
|
glue(pl110_draw_line8_bbbp_rgb,BITS),
|
2011-07-22 15:19:33 +02:00
|
|
|
glue(pl110_draw_line16_555_bbbp_rgb,BITS),
|
2007-10-05 01:45:31 +02:00
|
|
|
glue(pl110_draw_line32_bbbp_rgb,BITS),
|
2011-07-22 15:19:33 +02:00
|
|
|
glue(pl110_draw_line16_bbbp_rgb,BITS),
|
|
|
|
glue(pl110_draw_line12_bbbp_rgb,BITS),
|
2007-10-05 01:45:31 +02:00
|
|
|
|
|
|
|
glue(pl110_draw_line1_lbbp_rgb,BITS),
|
|
|
|
glue(pl110_draw_line2_lbbp_rgb,BITS),
|
|
|
|
glue(pl110_draw_line4_lbbp_rgb,BITS),
|
|
|
|
glue(pl110_draw_line8_lbbp_rgb,BITS),
|
2011-07-22 15:19:33 +02:00
|
|
|
glue(pl110_draw_line16_555_lbbp_rgb,BITS),
|
2007-10-05 01:45:31 +02:00
|
|
|
glue(pl110_draw_line32_lbbp_rgb,BITS),
|
2011-07-22 15:19:33 +02:00
|
|
|
glue(pl110_draw_line16_lbbp_rgb,BITS),
|
|
|
|
glue(pl110_draw_line12_lbbp_rgb,BITS),
|
2006-02-06 05:11:15 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#undef BITS
|
|
|
|
#undef COPY_PIXEL
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#if ORDER == 0
|
2007-10-05 01:45:31 +02:00
|
|
|
#define NAME glue(glue(lblp_, BORDER), BITS)
|
2009-07-27 16:13:06 +02:00
|
|
|
#ifdef HOST_WORDS_BIGENDIAN
|
2006-02-06 05:11:15 +01:00
|
|
|
#define SWAP_WORDS 1
|
|
|
|
#endif
|
|
|
|
#elif ORDER == 1
|
2007-10-05 01:45:31 +02:00
|
|
|
#define NAME glue(glue(bbbp_, BORDER), BITS)
|
2009-07-27 16:13:06 +02:00
|
|
|
#ifndef HOST_WORDS_BIGENDIAN
|
2006-02-06 05:11:15 +01:00
|
|
|
#define SWAP_WORDS 1
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define SWAP_PIXELS 1
|
2007-10-05 01:45:31 +02:00
|
|
|
#define NAME glue(glue(lbbp_, BORDER), BITS)
|
2009-07-27 16:13:06 +02:00
|
|
|
#ifdef HOST_WORDS_BIGENDIAN
|
2006-02-06 05:11:15 +01:00
|
|
|
#define SWAP_WORDS 1
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define FN_2(x, y) FN(x, y) FN(x+1, y)
|
2006-10-18 23:16:44 +02:00
|
|
|
#define FN_4(x, y) FN_2(x, y) FN_2(x+2, y)
|
2006-02-06 05:11:15 +01:00
|
|
|
#define FN_8(y) FN_4(0, y) FN_4(4, y)
|
|
|
|
|
2009-04-01 14:27:59 +02:00
|
|
|
static void glue(pl110_draw_line1_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep)
|
2006-02-06 05:11:15 +01:00
|
|
|
{
|
2012-08-27 13:32:36 +02:00
|
|
|
uint32_t *palette = opaque;
|
2006-02-06 05:11:15 +01:00
|
|
|
uint32_t data;
|
|
|
|
while (width > 0) {
|
|
|
|
data = *(uint32_t *)src;
|
|
|
|
#ifdef SWAP_PIXELS
|
2012-08-27 13:32:36 +02:00
|
|
|
#define FN(x, y) COPY_PIXEL(d, palette[(data >> (y + 7 - (x))) & 1]);
|
2006-02-06 05:11:15 +01:00
|
|
|
#else
|
2012-08-27 13:32:36 +02:00
|
|
|
#define FN(x, y) COPY_PIXEL(d, palette[(data >> ((x) + y)) & 1]);
|
2006-02-06 05:11:15 +01:00
|
|
|
#endif
|
2006-02-19 13:31:32 +01:00
|
|
|
#ifdef SWAP_WORDS
|
2006-02-06 05:11:15 +01:00
|
|
|
FN_8(24)
|
|
|
|
FN_8(16)
|
|
|
|
FN_8(8)
|
|
|
|
FN_8(0)
|
|
|
|
#else
|
|
|
|
FN_8(0)
|
|
|
|
FN_8(8)
|
|
|
|
FN_8(16)
|
|
|
|
FN_8(24)
|
|
|
|
#endif
|
|
|
|
#undef FN
|
|
|
|
width -= 32;
|
|
|
|
src += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-01 14:27:59 +02:00
|
|
|
static void glue(pl110_draw_line2_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep)
|
2006-02-06 05:11:15 +01:00
|
|
|
{
|
2012-08-27 13:32:36 +02:00
|
|
|
uint32_t *palette = opaque;
|
2006-02-06 05:11:15 +01:00
|
|
|
uint32_t data;
|
|
|
|
while (width > 0) {
|
|
|
|
data = *(uint32_t *)src;
|
|
|
|
#ifdef SWAP_PIXELS
|
2012-08-27 13:32:36 +02:00
|
|
|
#define FN(x, y) COPY_PIXEL(d, palette[(data >> (y + 6 - (x)*2)) & 3]);
|
2006-02-06 05:11:15 +01:00
|
|
|
#else
|
2012-08-27 13:32:36 +02:00
|
|
|
#define FN(x, y) COPY_PIXEL(d, palette[(data >> ((x)*2 + y)) & 3]);
|
2006-02-06 05:11:15 +01:00
|
|
|
#endif
|
2006-02-19 13:31:32 +01:00
|
|
|
#ifdef SWAP_WORDS
|
2006-02-06 05:11:15 +01:00
|
|
|
FN_4(0, 24)
|
|
|
|
FN_4(0, 16)
|
|
|
|
FN_4(0, 8)
|
|
|
|
FN_4(0, 0)
|
|
|
|
#else
|
|
|
|
FN_4(0, 0)
|
|
|
|
FN_4(0, 8)
|
|
|
|
FN_4(0, 16)
|
|
|
|
FN_4(0, 24)
|
|
|
|
#endif
|
|
|
|
#undef FN
|
|
|
|
width -= 16;
|
|
|
|
src += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-01 14:27:59 +02:00
|
|
|
static void glue(pl110_draw_line4_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep)
|
2006-02-06 05:11:15 +01:00
|
|
|
{
|
2012-08-27 13:32:36 +02:00
|
|
|
uint32_t *palette = opaque;
|
2006-02-06 05:11:15 +01:00
|
|
|
uint32_t data;
|
|
|
|
while (width > 0) {
|
|
|
|
data = *(uint32_t *)src;
|
|
|
|
#ifdef SWAP_PIXELS
|
2012-08-27 13:32:36 +02:00
|
|
|
#define FN(x, y) COPY_PIXEL(d, palette[(data >> (y + 4 - (x)*4)) & 0xf]);
|
2006-02-06 05:11:15 +01:00
|
|
|
#else
|
2012-08-27 13:32:36 +02:00
|
|
|
#define FN(x, y) COPY_PIXEL(d, palette[(data >> ((x)*4 + y)) & 0xf]);
|
2006-02-06 05:11:15 +01:00
|
|
|
#endif
|
2006-02-19 13:31:32 +01:00
|
|
|
#ifdef SWAP_WORDS
|
2006-02-06 05:11:15 +01:00
|
|
|
FN_2(0, 24)
|
|
|
|
FN_2(0, 16)
|
|
|
|
FN_2(0, 8)
|
|
|
|
FN_2(0, 0)
|
|
|
|
#else
|
|
|
|
FN_2(0, 0)
|
|
|
|
FN_2(0, 8)
|
|
|
|
FN_2(0, 16)
|
|
|
|
FN_2(0, 24)
|
|
|
|
#endif
|
|
|
|
#undef FN
|
|
|
|
width -= 8;
|
|
|
|
src += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-01 14:27:59 +02:00
|
|
|
static void glue(pl110_draw_line8_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep)
|
2006-02-06 05:11:15 +01:00
|
|
|
{
|
2012-08-27 13:32:36 +02:00
|
|
|
uint32_t *palette = opaque;
|
2006-02-06 05:11:15 +01:00
|
|
|
uint32_t data;
|
|
|
|
while (width > 0) {
|
|
|
|
data = *(uint32_t *)src;
|
2012-08-27 13:32:36 +02:00
|
|
|
#define FN(x) COPY_PIXEL(d, palette[(data >> (x)) & 0xff]);
|
2006-02-19 13:31:32 +01:00
|
|
|
#ifdef SWAP_WORDS
|
2006-02-06 05:11:15 +01:00
|
|
|
FN(24)
|
|
|
|
FN(16)
|
|
|
|
FN(8)
|
|
|
|
FN(0)
|
|
|
|
#else
|
|
|
|
FN(0)
|
|
|
|
FN(8)
|
|
|
|
FN(16)
|
|
|
|
FN(24)
|
|
|
|
#endif
|
|
|
|
#undef FN
|
|
|
|
width -= 4;
|
|
|
|
src += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-01 14:27:59 +02:00
|
|
|
static void glue(pl110_draw_line16_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep)
|
2006-02-06 05:11:15 +01:00
|
|
|
{
|
|
|
|
uint32_t data;
|
|
|
|
unsigned int r, g, b;
|
|
|
|
while (width > 0) {
|
|
|
|
data = *(uint32_t *)src;
|
2006-02-19 13:31:32 +01:00
|
|
|
#ifdef SWAP_WORDS
|
2006-02-06 05:11:15 +01:00
|
|
|
data = bswap32(data);
|
|
|
|
#endif
|
2007-10-05 01:45:31 +02:00
|
|
|
#ifdef RGB
|
|
|
|
#define LSB r
|
|
|
|
#define MSB b
|
|
|
|
#else
|
|
|
|
#define LSB b
|
|
|
|
#define MSB r
|
|
|
|
#endif
|
2006-02-06 05:11:15 +01:00
|
|
|
#if 0
|
2007-10-05 01:45:31 +02:00
|
|
|
LSB = data & 0x1f;
|
2006-02-06 05:11:15 +01:00
|
|
|
data >>= 5;
|
|
|
|
g = data & 0x3f;
|
|
|
|
data >>= 6;
|
2007-10-05 01:45:31 +02:00
|
|
|
MSB = data & 0x1f;
|
2006-02-06 05:11:15 +01:00
|
|
|
data >>= 5;
|
|
|
|
#else
|
2007-10-05 01:45:31 +02:00
|
|
|
LSB = (data & 0x1f) << 3;
|
2006-02-06 05:11:15 +01:00
|
|
|
data >>= 5;
|
|
|
|
g = (data & 0x3f) << 2;
|
|
|
|
data >>= 6;
|
2007-10-05 01:45:31 +02:00
|
|
|
MSB = (data & 0x1f) << 3;
|
2006-02-06 05:11:15 +01:00
|
|
|
data >>= 5;
|
|
|
|
#endif
|
|
|
|
COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b));
|
2007-10-05 01:45:31 +02:00
|
|
|
LSB = (data & 0x1f) << 3;
|
2006-02-06 05:11:15 +01:00
|
|
|
data >>= 5;
|
|
|
|
g = (data & 0x3f) << 2;
|
|
|
|
data >>= 6;
|
2007-10-05 01:45:31 +02:00
|
|
|
MSB = (data & 0x1f) << 3;
|
2006-02-06 05:11:15 +01:00
|
|
|
data >>= 5;
|
|
|
|
COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b));
|
2007-10-05 01:45:31 +02:00
|
|
|
#undef MSB
|
|
|
|
#undef LSB
|
2006-02-06 05:11:15 +01:00
|
|
|
width -= 2;
|
|
|
|
src += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-01 14:27:59 +02:00
|
|
|
static void glue(pl110_draw_line32_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep)
|
2006-02-06 05:11:15 +01:00
|
|
|
{
|
|
|
|
uint32_t data;
|
|
|
|
unsigned int r, g, b;
|
|
|
|
while (width > 0) {
|
|
|
|
data = *(uint32_t *)src;
|
2007-10-05 01:45:31 +02:00
|
|
|
#ifdef RGB
|
|
|
|
#define LSB r
|
|
|
|
#define MSB b
|
|
|
|
#else
|
|
|
|
#define LSB b
|
|
|
|
#define MSB r
|
|
|
|
#endif
|
2009-05-06 17:18:34 +02:00
|
|
|
#ifndef SWAP_WORDS
|
2007-10-05 01:45:31 +02:00
|
|
|
LSB = data & 0xff;
|
2006-02-06 05:11:15 +01:00
|
|
|
g = (data >> 8) & 0xff;
|
2007-10-05 01:45:31 +02:00
|
|
|
MSB = (data >> 16) & 0xff;
|
2006-02-06 05:11:15 +01:00
|
|
|
#else
|
2007-10-05 01:45:31 +02:00
|
|
|
LSB = (data >> 24) & 0xff;
|
2006-02-06 05:11:15 +01:00
|
|
|
g = (data >> 16) & 0xff;
|
2007-10-05 01:45:31 +02:00
|
|
|
MSB = (data >> 8) & 0xff;
|
2006-02-06 05:11:15 +01:00
|
|
|
#endif
|
|
|
|
COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b));
|
2007-10-05 01:45:31 +02:00
|
|
|
#undef MSB
|
|
|
|
#undef LSB
|
2006-02-06 05:11:15 +01:00
|
|
|
width--;
|
|
|
|
src += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-22 15:19:33 +02:00
|
|
|
static void glue(pl110_draw_line16_555_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep)
|
|
|
|
{
|
|
|
|
/* RGB 555 plus an intensity bit (which we ignore) */
|
|
|
|
uint32_t data;
|
|
|
|
unsigned int r, g, b;
|
|
|
|
while (width > 0) {
|
|
|
|
data = *(uint32_t *)src;
|
|
|
|
#ifdef SWAP_WORDS
|
|
|
|
data = bswap32(data);
|
|
|
|
#endif
|
|
|
|
#ifdef RGB
|
|
|
|
#define LSB r
|
|
|
|
#define MSB b
|
|
|
|
#else
|
|
|
|
#define LSB b
|
|
|
|
#define MSB r
|
|
|
|
#endif
|
|
|
|
LSB = (data & 0x1f) << 3;
|
|
|
|
data >>= 5;
|
|
|
|
g = (data & 0x1f) << 3;
|
|
|
|
data >>= 5;
|
|
|
|
MSB = (data & 0x1f) << 3;
|
|
|
|
data >>= 5;
|
|
|
|
COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b));
|
|
|
|
LSB = (data & 0x1f) << 3;
|
|
|
|
data >>= 5;
|
|
|
|
g = (data & 0x1f) << 3;
|
|
|
|
data >>= 5;
|
|
|
|
MSB = (data & 0x1f) << 3;
|
|
|
|
data >>= 6;
|
|
|
|
COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b));
|
|
|
|
#undef MSB
|
|
|
|
#undef LSB
|
|
|
|
width -= 2;
|
|
|
|
src += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void glue(pl110_draw_line12_,NAME)(void *opaque, uint8_t *d, const uint8_t *src, int width, int deststep)
|
|
|
|
{
|
|
|
|
/* RGB 444 with 4 bits of zeroes at the top of each halfword */
|
|
|
|
uint32_t data;
|
|
|
|
unsigned int r, g, b;
|
|
|
|
while (width > 0) {
|
|
|
|
data = *(uint32_t *)src;
|
|
|
|
#ifdef SWAP_WORDS
|
|
|
|
data = bswap32(data);
|
|
|
|
#endif
|
|
|
|
#ifdef RGB
|
|
|
|
#define LSB r
|
|
|
|
#define MSB b
|
|
|
|
#else
|
|
|
|
#define LSB b
|
|
|
|
#define MSB r
|
|
|
|
#endif
|
|
|
|
LSB = (data & 0xf) << 4;
|
|
|
|
data >>= 4;
|
|
|
|
g = (data & 0xf) << 4;
|
|
|
|
data >>= 4;
|
|
|
|
MSB = (data & 0xf) << 4;
|
|
|
|
data >>= 8;
|
|
|
|
COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b));
|
|
|
|
LSB = (data & 0xf) << 4;
|
|
|
|
data >>= 4;
|
|
|
|
g = (data & 0xf) << 4;
|
|
|
|
data >>= 4;
|
|
|
|
MSB = (data & 0xf) << 4;
|
|
|
|
data >>= 8;
|
|
|
|
COPY_PIXEL(d, glue(rgb_to_pixel,BITS)(r, g, b));
|
|
|
|
#undef MSB
|
|
|
|
#undef LSB
|
|
|
|
width -= 2;
|
|
|
|
src += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-06 05:11:15 +01:00
|
|
|
#undef SWAP_PIXELS
|
|
|
|
#undef NAME
|
|
|
|
#undef SWAP_WORDS
|
|
|
|
#undef ORDER
|
|
|
|
|
|
|
|
#endif
|