[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

the scrambled images at 24 and 32 bpp fixed?



I swapped the translate function in patch-18-3 to the below, it seems
to have fixed the problems... could someone with the problems ack? I'll
make a patch-18-4 available within a few mins...

Sveinn and Eric seems to be good targets for this test... ;)

//

peter

================
 

static uint8 *
translate (int width, int height, uint8 * data)
{
  uint32 i;
  uint8 *d2 = xmalloc(width*height*TOBYTES(bpp == 24 ? 32 : bpp));
  uint8 *d3 = d2;

  if(ImageByteOrder(display) == MSBFirst) {
    for(i=width*height; i; i--){
        uint32 pix = Ctrans(*data++);
        switch( bpp ){
                case 32:
                case 24:
                 *((uint32*)d3) =  pix;
                 d3 += sizeof (uint32);
                 break;
//                 *d3++ = pix>>24;
//                 *d3++ = pix>>16;
                case 16:
                 *d3++ = pix>>8;
                case 8:
                 *d3++ = pix;
        }
    }
  }else{
    for(i=width*height; i; i--){
      uint32 pix = Ctrans(*data++);
      switch( bpp ){
        case 32:
        case 24:
               *((uint32*)d3) =  pix;
               d3 += sizeof (uint32);
               break;
//              *d3++ = pix;
//              *d3++ = pix>>8;
//              *d3++ = pix>>16;
//              *d3++ = pix>>24;
//              break;
        case 16:
              *d3++ = pix;
              *d3++ = pix>>8;
                break;
        case 8:
              *d3++ = pix;
      }
    }
  }

  return d2;
}