Commit 53c862a88e209ecfb42d47a16ce92f92daf68c0a
1 parent
b6b8bd18
endianness fixes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@958 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
15 additions
and
3 deletions
hw/vga_template.h
| @@ -346,7 +346,7 @@ static void glue(vga_draw_line8_, DEPTH)(VGAState *s1, uint8_t *d, | @@ -346,7 +346,7 @@ static void glue(vga_draw_line8_, DEPTH)(VGAState *s1, uint8_t *d, | ||
| 346 | static void glue(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d, | 346 | static void glue(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d, |
| 347 | const uint8_t *s, int width) | 347 | const uint8_t *s, int width) |
| 348 | { | 348 | { |
| 349 | -#if DEPTH == 15 && !defined(WORDS_BIGENDIAN) | 349 | +#if DEPTH == 15 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) |
| 350 | memcpy(d, s, width * 2); | 350 | memcpy(d, s, width * 2); |
| 351 | #else | 351 | #else |
| 352 | int w; | 352 | int w; |
| @@ -371,7 +371,7 @@ static void glue(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d, | @@ -371,7 +371,7 @@ static void glue(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d, | ||
| 371 | static void glue(vga_draw_line16_, DEPTH)(VGAState *s1, uint8_t *d, | 371 | static void glue(vga_draw_line16_, DEPTH)(VGAState *s1, uint8_t *d, |
| 372 | const uint8_t *s, int width) | 372 | const uint8_t *s, int width) |
| 373 | { | 373 | { |
| 374 | -#if DEPTH == 16 && !defined(WORDS_BIGENDIAN) | 374 | +#if DEPTH == 16 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) |
| 375 | memcpy(d, s, width * 2); | 375 | memcpy(d, s, width * 2); |
| 376 | #else | 376 | #else |
| 377 | int w; | 377 | int w; |
| @@ -401,9 +401,15 @@ static void glue(vga_draw_line24_, DEPTH)(VGAState *s1, uint8_t *d, | @@ -401,9 +401,15 @@ static void glue(vga_draw_line24_, DEPTH)(VGAState *s1, uint8_t *d, | ||
| 401 | 401 | ||
| 402 | w = width; | 402 | w = width; |
| 403 | do { | 403 | do { |
| 404 | +#if defined(TARGET_WORDS_BIGENDIAN) | ||
| 405 | + r = s[0]; | ||
| 406 | + g = s[1]; | ||
| 407 | + b = s[2]; | ||
| 408 | +#else | ||
| 404 | b = s[0]; | 409 | b = s[0]; |
| 405 | g = s[1]; | 410 | g = s[1]; |
| 406 | r = s[2]; | 411 | r = s[2]; |
| 412 | +#endif | ||
| 407 | ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b); | 413 | ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b); |
| 408 | s += 3; | 414 | s += 3; |
| 409 | d += BPP; | 415 | d += BPP; |
| @@ -416,7 +422,7 @@ static void glue(vga_draw_line24_, DEPTH)(VGAState *s1, uint8_t *d, | @@ -416,7 +422,7 @@ static void glue(vga_draw_line24_, DEPTH)(VGAState *s1, uint8_t *d, | ||
| 416 | static void glue(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d, | 422 | static void glue(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d, |
| 417 | const uint8_t *s, int width) | 423 | const uint8_t *s, int width) |
| 418 | { | 424 | { |
| 419 | -#if DEPTH == 32 && !defined(WORDS_BIGENDIAN) | 425 | +#if DEPTH == 32 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) |
| 420 | memcpy(d, s, width * 4); | 426 | memcpy(d, s, width * 4); |
| 421 | #else | 427 | #else |
| 422 | int w; | 428 | int w; |
| @@ -424,9 +430,15 @@ static void glue(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d, | @@ -424,9 +430,15 @@ static void glue(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d, | ||
| 424 | 430 | ||
| 425 | w = width; | 431 | w = width; |
| 426 | do { | 432 | do { |
| 433 | +#if defined(TARGET_WORDS_BIGENDIAN) | ||
| 434 | + r = s[1]; | ||
| 435 | + g = s[2]; | ||
| 436 | + b = s[3]; | ||
| 437 | +#else | ||
| 427 | b = s[0]; | 438 | b = s[0]; |
| 428 | g = s[1]; | 439 | g = s[1]; |
| 429 | r = s[2]; | 440 | r = s[2]; |
| 441 | +#endif | ||
| 430 | ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b); | 442 | ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b); |
| 431 | s += 4; | 443 | s += 4; |
| 432 | d += BPP; | 444 | d += BPP; |