ps_image.cxx: better byte-swapping algorithm.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7506 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
fe76949b83
commit
595b20f802
@ -182,22 +182,13 @@ int Fl_PSfile_Device::alpha_mask(const uchar * data, int w, int h, int D, int LD
|
||||
return 0;
|
||||
}
|
||||
|
||||
// bitwise inversion of all 4-bit quantities
|
||||
static const unsigned char swapped[16] = {0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};
|
||||
|
||||
|
||||
// TODO: anybody has more efficient algoritm?
|
||||
static inline uchar swap_byte(const uchar i){
|
||||
uchar b =0;
|
||||
if(i & 1) b |= 128;
|
||||
if(i & 2) b |= 64;
|
||||
if(i & 4) b |= 32;
|
||||
if(i & 8) b |= 16;
|
||||
if(i & 16) b |= 8;
|
||||
if(i & 32) b |= 4;
|
||||
if(i & 64) b |= 2;
|
||||
if(i & 128) b |= 1;
|
||||
return b;
|
||||
}
|
||||
|
||||
// bitwise inversion of a byte
|
||||
static inline uchar swap_byte(const uchar b){
|
||||
return (swapped[b & 0xF] << 4) | swapped[b >> 4];
|
||||
}
|
||||
|
||||
extern uchar **fl_mask_bitmap;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user