Revision 688ea2eb

b/hw/tcx.c
124 124
    }
125 125
}
126 126

  
127
/*
128
  XXX Could be much more optimal:
129
  * detect if line/page/whole screen is in 24 bit mode
130
  * if destination is also BGR, use memcpy
131
  */
127 132
static inline void tcx24_draw_line32(TCXState *s1, uint8_t *d,
128 133
                                     const uint8_t *s, int width,
129 134
                                     const uint32_t *cplane,
130 135
                                     const uint32_t *s24)
131 136
{
132
    int x;
133
    uint8_t val;
137
    int x, bgr, r, g, b;
138
    uint8_t val, *p8;
134 139
    uint32_t *p = (uint32_t *)d;
135 140
    uint32_t dval;
136 141

  
142
    bgr = s1->ds->bgr;
137 143
    for(x = 0; x < width; x++, s++, s24++) {
138
        if ((bswap32(*cplane++) & 0xff000000) == 0x03000000) { // 24-bit direct
139
            dval = bswap32(*s24) & 0x00ffffff;
144
        if ((be32_to_cpu(*cplane++) & 0xff000000) == 0x03000000) {
145
            // 24-bit direct, BGR order
146
            p8 = (uint8_t *)s24;
147
            p8++;
148
            b = *p8++;
149
            g = *p8++;
150
            r = *p8++;
151
            if (bgr)
152
                dval = rgb_to_pixel32bgr(r, g, b);
153
            else
154
                dval = rgb_to_pixel32(r, g, b);
140 155
        } else {
141 156
            val = *s;
142 157
            dval = s1->palette[val];

Also available in: Unified diff