Commit 53c862a88e209ecfb42d47a16ce92f92daf68c0a

Authored by bellard
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 346 static void glue(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d,
347 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 350 memcpy(d, s, width * 2);
351 351 #else
352 352 int w;
... ... @@ -371,7 +371,7 @@ static void glue(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d,
371 371 static void glue(vga_draw_line16_, DEPTH)(VGAState *s1, uint8_t *d,
372 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 375 memcpy(d, s, width * 2);
376 376 #else
377 377 int w;
... ... @@ -401,9 +401,15 @@ static void glue(vga_draw_line24_, DEPTH)(VGAState *s1, uint8_t *d,
401 401  
402 402 w = width;
403 403 do {
  404 +#if defined(TARGET_WORDS_BIGENDIAN)
  405 + r = s[0];
  406 + g = s[1];
  407 + b = s[2];
  408 +#else
404 409 b = s[0];
405 410 g = s[1];
406 411 r = s[2];
  412 +#endif
407 413 ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b);
408 414 s += 3;
409 415 d += BPP;
... ... @@ -416,7 +422,7 @@ static void glue(vga_draw_line24_, DEPTH)(VGAState *s1, uint8_t *d,
416 422 static void glue(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d,
417 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 426 memcpy(d, s, width * 4);
421 427 #else
422 428 int w;
... ... @@ -424,9 +430,15 @@ static void glue(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d,
424 430  
425 431 w = width;
426 432 do {
  433 +#if defined(TARGET_WORDS_BIGENDIAN)
  434 + r = s[1];
  435 + g = s[2];
  436 + b = s[3];
  437 +#else
427 438 b = s[0];
428 439 g = s[1];
429 440 r = s[2];
  441 +#endif
430 442 ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b);
431 443 s += 4;
432 444 d += BPP;
... ...