XBM loading finally works (thanks Guillermo)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5543 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-01-19 23:53:18 +00:00
parent 7ddef9ed7a
commit 0765adca2b
2 changed files with 25 additions and 12 deletions

View File

@@ -255,16 +255,22 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
for ( int rows = 0; rows < height; rows++ )
{
// note that offset cannot be size_t due to >= 0 test!
for ( int offset = bytesPerLine - 1; offset >= 0; offset-- )
for ( size_t cols = 0; cols < bytesPerLine; cols++ )
{
*dst++ = *(src + offset);
unsigned char val = *src++;
unsigned char reversed = 0;
for ( int bits = 0; bits < 8; bits++)
{
reversed <<= 1;
reversed |= (val & 0x01);
val >>= 1;
}
*dst++ = reversed;
}
if ( padding )
*dst++ = 0;
src += bytesPerLine;
}
}
else