summaryrefslogtreecommitdiff
path: root/hw/tcx.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-07-24 11:26:38 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-07-24 11:26:38 +0000
commit688ea2eb9b251c73c78a8b60c8d5800730927be2 (patch)
tree2755845ef2206ee13e4ba3d2e3ebacf4288ab774 /hw/tcx.c
parent749ecd9953a2d624be9c52a3a12c915dd252274b (diff)
downloadqemu-688ea2eb9b251c73c78a8b60c8d5800730927be2.tar.gz
Fix 24 bit mode
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4937 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/tcx.c')
-rw-r--r--hw/tcx.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/hw/tcx.c b/hw/tcx.c
index df02ea74e2..52a56c2c33 100644
--- a/hw/tcx.c
+++ b/hw/tcx.c
@@ -124,19 +124,34 @@ static void tcx_draw_line8(TCXState *s1, uint8_t *d,
}
}
+/*
+ XXX Could be much more optimal:
+ * detect if line/page/whole screen is in 24 bit mode
+ * if destination is also BGR, use memcpy
+ */
static inline void tcx24_draw_line32(TCXState *s1, uint8_t *d,
const uint8_t *s, int width,
const uint32_t *cplane,
const uint32_t *s24)
{
- int x;
- uint8_t val;
+ int x, bgr, r, g, b;
+ uint8_t val, *p8;
uint32_t *p = (uint32_t *)d;
uint32_t dval;
+ bgr = s1->ds->bgr;
for(x = 0; x < width; x++, s++, s24++) {
- if ((bswap32(*cplane++) & 0xff000000) == 0x03000000) { // 24-bit direct
- dval = bswap32(*s24) & 0x00ffffff;
+ if ((be32_to_cpu(*cplane++) & 0xff000000) == 0x03000000) {
+ // 24-bit direct, BGR order
+ p8 = (uint8_t *)s24;
+ p8++;
+ b = *p8++;
+ g = *p8++;
+ r = *p8++;
+ if (bgr)
+ dval = rgb_to_pixel32bgr(r, g, b);
+ else
+ dval = rgb_to_pixel32(r, g, b);
} else {
val = *s;
dval = s1->palette[val];