|
|
* hopelessly slow. | * hopelessly slow. |
*/ | */ |
| |
BITMAP *bitmap_convert_lsb8(Uchar *bits, int w, int h) |
BITMAP *bitmap_convert_lsb8(Uchar *bits, int w, int h, int stride) |
{ | { |
BITMAP *bm; | BITMAP *bm; |
int i; | int i; |
|
|
for(i = 0; i < h; i++) { | for(i = 0; i < h; i++) { |
#ifdef WORD_LITTLE_ENDIAN | #ifdef WORD_LITTLE_ENDIAN |
memcpy(unit, curr, bytes); | memcpy(unit, curr, bytes); |
curr += bytes; |
curr += stride; |
#else | #else |
int j; | int j; |
| |
for(j = 0; j < bytes; curr++, j++) | for(j = 0; j < bytes; curr++, j++) |
unit[j] = bit_swap[*curr]; | unit[j] = bit_swap[*curr]; |
|
cur += stride - bytes; |
#endif | #endif |
memzero(unit + bytes, bm->stride - bytes); | memzero(unit + bytes, bm->stride - bytes); |
unit += bm->stride; | unit += bm->stride; |
|
|
return bm; | return bm; |
} | } |
| |
BITMAP *bitmap_convert_msb8(Uchar *data, int w, int h) |
BITMAP *bitmap_convert_msb8(Uchar *data, int w, int h, int stride) |
{ | { |
BITMAP *bm; | BITMAP *bm; |
Uchar *unit; | Uchar *unit; |
|
|
| |
for(j = 0; j < bytes; curr++, j++) | for(j = 0; j < bytes; curr++, j++) |
unit[j] = bit_swap[*curr]; | unit[j] = bit_swap[*curr]; |
|
curr += stride - bytes; |
#else | #else |
memcpy(unit, curr, bytes); | memcpy(unit, curr, bytes); |
curr += bytes; |
curr += stride; |
#endif | #endif |
memzero(unit + bytes, bm->stride - bytes); | memzero(unit + bytes, bm->stride - bytes); |
unit += bm->stride; | unit += bm->stride; |