Commit 53c862a8 authored by bellard's avatar bellard
Browse files

endianness fixes


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@958 c046a42c-6fe2-441c-8c8c-71466251a162
parent b6b8bd18
...@@ -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,
static void glue(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d, static void glue(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d,
const uint8_t *s, int width) const uint8_t *s, int width)
{ {
#if DEPTH == 15 && !defined(WORDS_BIGENDIAN) #if DEPTH == 15 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
memcpy(d, s, width * 2); memcpy(d, s, width * 2);
#else #else
int w; 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,
static void glue(vga_draw_line16_, DEPTH)(VGAState *s1, uint8_t *d, static void glue(vga_draw_line16_, DEPTH)(VGAState *s1, uint8_t *d,
const uint8_t *s, int width) const uint8_t *s, int width)
{ {
#if DEPTH == 16 && !defined(WORDS_BIGENDIAN) #if DEPTH == 16 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
memcpy(d, s, width * 2); memcpy(d, s, width * 2);
#else #else
int w; 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,
w = width; w = width;
do { do {
#if defined(TARGET_WORDS_BIGENDIAN)
r = s[0];
g = s[1];
b = s[2];
#else
b = s[0]; b = s[0];
g = s[1]; g = s[1];
r = s[2]; r = s[2];
#endif
((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b); ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b);
s += 3; s += 3;
d += BPP; 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,
static void glue(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d, static void glue(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d,
const uint8_t *s, int width) const uint8_t *s, int width)
{ {
#if DEPTH == 32 && !defined(WORDS_BIGENDIAN) #if DEPTH == 32 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
memcpy(d, s, width * 4); memcpy(d, s, width * 4);
#else #else
int w; 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,
w = width; w = width;
do { do {
#if defined(TARGET_WORDS_BIGENDIAN)
r = s[1];
g = s[2];
b = s[3];
#else
b = s[0]; b = s[0];
g = s[1]; g = s[1];
r = s[2]; r = s[2];
#endif
((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b); ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b);
s += 4; s += 4;
d += BPP; d += BPP;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment