mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-22 15:51:16 +00:00
getting closer
This commit is contained in:
parent
0c27252c87
commit
74013e8956
@ -49,6 +49,7 @@ int MxBitmap::vtable1c(int p_width, int p_height, MxPalette *p_palette, int)
|
|||||||
MxResult MxBitmap::LoadFile(HANDLE p_handle)
|
MxResult MxBitmap::LoadFile(HANDLE p_handle)
|
||||||
{
|
{
|
||||||
void* lpBuffer;
|
void* lpBuffer;
|
||||||
|
BITMAPINFO *infoHdr;
|
||||||
MxS32 height;
|
MxS32 height;
|
||||||
MxBool operation_ret;
|
MxBool operation_ret;
|
||||||
MxResult result = FAILURE;
|
MxResult result = FAILURE;
|
||||||
@ -57,9 +58,10 @@ MxResult MxBitmap::LoadFile(HANDLE p_handle)
|
|||||||
|
|
||||||
operation_ret = ReadFile(p_handle, &hdr, 14, &bytesRead, NULL);
|
operation_ret = ReadFile(p_handle, &hdr, 14, &bytesRead, NULL);
|
||||||
if ((operation_ret != 0) && (hdr.bfType == g_bitmapSignature)) {
|
if ((operation_ret != 0) && (hdr.bfType == g_bitmapSignature)) {
|
||||||
this->m_info = new BITMAPINFO;
|
infoHdr = (BITMAPINFO*) malloc(1064);
|
||||||
if(this->m_info != NULL) {
|
this->m_info = infoHdr;
|
||||||
operation_ret = ReadFile(p_handle, this->m_info, 1064, &bytesRead, NULL);
|
if(infoHdr != NULL) {
|
||||||
|
operation_ret = ReadFile(p_handle, infoHdr, 1064, &bytesRead, NULL);
|
||||||
if ((operation_ret != 0) && ((this->m_info->bmiHeader).biBitCount == 8)) {
|
if ((operation_ret != 0) && ((this->m_info->bmiHeader).biBitCount == 8)) {
|
||||||
lpBuffer = (void*) malloc(hdr.bfSize - 1078);
|
lpBuffer = (void*) malloc(hdr.bfSize - 1078);
|
||||||
this->m_data = (LPVOID*) lpBuffer;
|
this->m_data = (LPVOID*) lpBuffer;
|
||||||
@ -69,17 +71,18 @@ MxResult MxBitmap::LoadFile(HANDLE p_handle)
|
|||||||
this->m_bmiHeader = &this->m_info->bmiHeader;
|
this->m_bmiHeader = &this->m_info->bmiHeader;
|
||||||
this->m_paletteData = this->m_info->bmiColors;
|
this->m_paletteData = this->m_info->bmiColors;
|
||||||
if((this->m_info->bmiHeader).biSizeImage == 0) {
|
if((this->m_info->bmiHeader).biSizeImage == 0) {
|
||||||
if ((this->m_info->bmiHeader).biHeight < 1) {
|
height = (this->m_info->bmiHeader).biHeight;
|
||||||
this->m_info->bmiHeader.biHeight *= -1;
|
if (height < 1) {
|
||||||
|
height *= -1;
|
||||||
}
|
}
|
||||||
(this->m_info->bmiHeader).biSizeImage = ((this->m_info->bmiHeader).biWidth + 3U & 0xfffffffc) * this->m_info->bmiHeader.biHeight;
|
(this->m_info->bmiHeader).biSizeImage = ((this->m_info->bmiHeader).biWidth + 3U & 0xfffffffc) * height;
|
||||||
}
|
}
|
||||||
result = SUCCESS;
|
result = SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // TODO: g_bitmapSignature
|
}
|
||||||
if (result != SUCCESS) {
|
if (result != SUCCESS) {
|
||||||
if (this->m_info != NULL) {
|
if (this->m_info != NULL) {
|
||||||
delete this->m_info;
|
delete this->m_info;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user