'width' and 'height' parameters of wxBitmapFromMemoryRGBA should be unsigned.

Not a big deal, but it's good to do it for the sake of maintaining practicalities.
This commit is contained in:
Lioncash 2013-01-13 23:42:18 -05:00
parent 020ab743a9
commit 4ea4f2eb45
1 changed files with 6 additions and 6 deletions

View File

@ -39,11 +39,11 @@ const u8 hdr[] = {
0x00,0x00,0x00,0x00 0x00,0x00,0x00,0x00
}; };
wxBitmap wxBitmapFromMemoryRGBA(const unsigned char* data, int width, int height) wxBitmap wxBitmapFromMemoryRGBA(const unsigned char* data, u32 width, u32 height)
{ {
int stride = (4*width); u32 stride = (4*width);
int bytes = (stride*height) + sizeof(hdr); u32 bytes = (stride*height) + sizeof(hdr);
bytes = (bytes+3)&(~3); bytes = (bytes+3)&(~3);
@ -54,13 +54,13 @@ wxBitmap wxBitmapFromMemoryRGBA(const unsigned char* data, int width, int height
u8 *pixelData = pdata + sizeof(hdr); u8 *pixelData = pdata + sizeof(hdr);
for (int y=0;y<height;y++) for (u32 y=0;y<height;y++)
{ {
memcpy(pixelData+y*stride,data+(height-y-1)*stride,stride); memcpy(pixelData+y*stride,data+(height-y-1)*stride,stride);
} }
*(int*)(pdata+18) = width; *(u32*)(pdata+18) = width;
*(int*)(pdata+22) = height; *(u32*)(pdata+22) = height;
*(u32*)(pdata+34) = bytes-sizeof(hdr); *(u32*)(pdata+34) = bytes-sizeof(hdr);
wxMemoryInputStream is(pdata, bytes); wxMemoryInputStream is(pdata, bytes);