fix bit order for ppc - cleanly.

SVN revision: 16362
This commit is contained in:
Carsten Haitzler 2005-08-26 04:16:57 +00:00
parent 44e0a11a43
commit 58c289f118
3 changed files with 57 additions and 25 deletions

View File

@ -41,16 +41,17 @@ struct _Outbuf
struct {
Convert_Pal *pal;
struct {
Display *disp;
Window win;
Pixmap mask;
Visual *vis;
Colormap cmap;
int depth;
int shm;
GC gc;
GC gcm;
int swap : 1;
Display *disp;
Window win;
Pixmap mask;
Visual *vis;
Colormap cmap;
int depth;
int shm;
GC gc;
GC gcm;
unsigned char swap : 1;
unsigned char bit_swap : 1;
} x;
struct {
DATA32 r, g, b;
@ -112,7 +113,7 @@ struct _X_Output_Buffer
/****/
void evas_software_x11_x_init (void);
void evas_software_x11_x_write_mask_line (X_Output_Buffer *xob, DATA32 *src, int w, int y);
void evas_software_x11_x_write_mask_line (Outbuf *buf, X_Output_Buffer *xob, DATA32 *src, int w, int y);
int evas_software_x11_x_can_do_shm (Display *d);
X_Output_Buffer *evas_software_x11_x_output_buffer_new (Display *d, Visual *v, int depth, int w, int h, int try_shm, void *data);
void evas_software_x11_x_output_buffer_free (X_Output_Buffer *xob, int sync);
@ -120,6 +121,7 @@ void evas_software_x11_x_output_buffer_paste (X_Output_Buffe
DATA8 *evas_software_x11_x_output_buffer_data (X_Output_Buffer *xob, int *bytes_per_line_ret);
int evas_software_x11_x_output_buffer_depth (X_Output_Buffer *xob);
int evas_software_x11_x_output_buffer_byte_order (X_Output_Buffer *xob);
int evas_software_x11_x_output_buffer_bit_order (X_Output_Buffer *xob);
void evas_software_x11_x_color_init (void);
Convert_Pal *evas_software_x11_x_color_allocate (Display *disp, Colormap cmap, Visual *vis, Convert_Pal_Mode colors);

View File

@ -72,9 +72,13 @@ evas_software_x11_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
#ifdef WORDS_BIGENDIAN
if (evas_software_x11_x_output_buffer_byte_order(xob) == LSBFirst)
buf->priv.x.swap = 1;
if (evas_software_x11_x_output_buffer_bit_order(xob) == MSBFirst)
buf->priv.x.bit_swap = 1;
#else
if (evas_software_x11_x_output_buffer_byte_order(xob) == MSBFirst)
buf->priv.x.swap = 1;
if (evas_software_x11_x_output_buffer_bit_order(xob) == MSBFirst)
buf->priv.x.bit_swap = 1;
#endif
if ((vis->class == TrueColor) || (vis->class == DirectColor))
{
@ -446,7 +450,7 @@ evas_software_x11_outbuf_push_updated_region(Outbuf * buf, RGBA_Image * update,
if (obr->mxob)
{
for (yy = 0; yy < obr->h; yy++)
evas_software_x11_x_write_mask_line(obr->mxob,
evas_software_x11_x_write_mask_line(buf, obr->mxob,
src_data +
(yy * obr->w), obr->w, yy);
}

View File

@ -4,7 +4,7 @@
static int _x_err = 0;
void
evas_software_x11_x_write_mask_line(X_Output_Buffer *xob, DATA32 *src, int w, int y)
evas_software_x11_x_write_mask_line(Outbuf *buf, X_Output_Buffer *xob, DATA32 *src, int w, int y)
{
int x;
DATA32 *src_ptr;
@ -14,19 +14,39 @@ evas_software_x11_x_write_mask_line(X_Output_Buffer *xob, DATA32 *src, int w, in
src_ptr = src;
dst_ptr = evas_software_x11_x_output_buffer_data(xob, &bpl);
dst_ptr = dst_ptr + (bpl * y);
for (x = 0; x < w; x += 8)
if (buf->priv.x.bit_swap)
{
*dst_ptr =
((A_VAL(&(src_ptr[0])) >> 7) << 0) |
((A_VAL(&(src_ptr[1])) >> 7) << 1) |
((A_VAL(&(src_ptr[2])) >> 7) << 2) |
((A_VAL(&(src_ptr[3])) >> 7) << 3) |
((A_VAL(&(src_ptr[4])) >> 7) << 4) |
((A_VAL(&(src_ptr[5])) >> 7) << 5) |
((A_VAL(&(src_ptr[6])) >> 7) << 6) |
((A_VAL(&(src_ptr[7])) >> 7) << 7);
src_ptr += 8;
dst_ptr++;
for (x = 0; x < w; x += 8)
{
*dst_ptr =
((A_VAL(&(src_ptr[0])) >> 7) << 7) |
((A_VAL(&(src_ptr[1])) >> 7) << 6) |
((A_VAL(&(src_ptr[2])) >> 7) << 5) |
((A_VAL(&(src_ptr[3])) >> 7) << 4) |
((A_VAL(&(src_ptr[4])) >> 7) << 3) |
((A_VAL(&(src_ptr[5])) >> 7) << 2) |
((A_VAL(&(src_ptr[6])) >> 7) << 1) |
((A_VAL(&(src_ptr[7])) >> 7) << 0);
src_ptr += 8;
dst_ptr++;
}
}
else
{
for (x = 0; x < w; x += 8)
{
*dst_ptr =
((A_VAL(&(src_ptr[0])) >> 7) << 0) |
((A_VAL(&(src_ptr[1])) >> 7) << 1) |
((A_VAL(&(src_ptr[2])) >> 7) << 2) |
((A_VAL(&(src_ptr[3])) >> 7) << 3) |
((A_VAL(&(src_ptr[4])) >> 7) << 4) |
((A_VAL(&(src_ptr[5])) >> 7) << 5) |
((A_VAL(&(src_ptr[6])) >> 7) << 6) |
((A_VAL(&(src_ptr[7])) >> 7) << 7);
src_ptr += 8;
dst_ptr++;
}
}
for (; x < w; x ++)
{
@ -192,3 +212,9 @@ evas_software_x11_x_output_buffer_byte_order(X_Output_Buffer *xob)
{
return xob->xim->byte_order;
}
int
evas_software_x11_x_output_buffer_bit_order(X_Output_Buffer *xob)
{
return xob->xim->bitmap_bit_order;
}