mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
some cleanup in surface.c
This commit is contained in:
parent
dc0204cf71
commit
bc40d0fc3b
@ -1038,16 +1038,16 @@ HRESULT dd_CreateSurface(
|
||||
{
|
||||
dst_surface->lx_pitch = dst_surface->bpp / 8;
|
||||
dst_surface->l_pitch = ((dst_surface->width * dst_surface->bpp + 31) & ~31) >> 3;
|
||||
dst_surface->size = dst_surface->l_pitch * dst_surface->height * dst_surface->lx_pitch;
|
||||
|
||||
DWORD bmp_width = dst_surface->l_pitch / dst_surface->lx_pitch;
|
||||
DWORD bmp_height = dst_surface->height;
|
||||
DWORD aligned_width = dst_surface->l_pitch / dst_surface->lx_pitch;
|
||||
|
||||
dst_surface->bmi =
|
||||
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
|
||||
|
||||
dst_surface->bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
dst_surface->bmi->bmiHeader.biWidth = bmp_width;
|
||||
dst_surface->bmi->bmiHeader.biHeight = -((int)bmp_height + 200);
|
||||
dst_surface->bmi->bmiHeader.biWidth = aligned_width;
|
||||
dst_surface->bmi->bmiHeader.biHeight = -((int)dst_surface->height + 200);
|
||||
dst_surface->bmi->bmiHeader.biPlanes = 1;
|
||||
dst_surface->bmi->bmiHeader.biBitCount = dst_surface->bpp;
|
||||
dst_surface->bmi->bmiHeader.biCompression = dst_surface->bpp == 8 ? BI_RGB : BI_BITFIELDS;
|
||||
@ -1060,7 +1060,7 @@ HRESULT dd_CreateSurface(
|
||||
}
|
||||
|
||||
dst_surface->bmi->bmiHeader.biSizeImage =
|
||||
((bmp_width * clr_bits + 31) & ~31) / 8 * bmp_height;
|
||||
((aligned_width * clr_bits + 31) & ~31) / 8 * dst_surface->height;
|
||||
|
||||
if (dst_surface->bpp == 8)
|
||||
{
|
||||
@ -1089,8 +1089,7 @@ HRESULT dd_CreateSurface(
|
||||
dst_surface->bitmap =
|
||||
CreateDIBSection(dst_surface->hdc, dst_surface->bmi, DIB_RGB_COLORS, (void**)&dst_surface->surface, NULL, 0);
|
||||
|
||||
dst_surface->bmi->bmiHeader.biHeight = -((int)bmp_height);
|
||||
dst_surface->size = dst_surface->l_pitch * bmp_height * dst_surface->lx_pitch;
|
||||
dst_surface->bmi->bmiHeader.biHeight = -((int)dst_surface->height);
|
||||
|
||||
if (!dst_surface->bitmap)
|
||||
{
|
||||
@ -1098,7 +1097,7 @@ HRESULT dd_CreateSurface(
|
||||
HeapAlloc(
|
||||
GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
dst_surface->l_pitch * (bmp_height + 200) * dst_surface->lx_pitch);
|
||||
dst_surface->l_pitch * (dst_surface->height + 200) * dst_surface->lx_pitch);
|
||||
}
|
||||
|
||||
if (dst_surface->caps & DDSCAPS_PRIMARYSURFACE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user