1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

#273 use 64bit aligned pitch

This commit is contained in:
FunkyFr3sh 2024-01-09 20:44:04 +01:00
parent 8d24dde49c
commit 7002639452
2 changed files with 11 additions and 11 deletions

View File

@ -211,7 +211,7 @@ HRESULT dd_EnumDisplayModes(
s.dwRefreshRate = 60;
s.dwHeight = m.dmPelsHeight;
s.dwWidth = m.dmPelsWidth;
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 63) & ~63) >> 3;
s.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
if (s.ddpfPixelFormat.dwRGBBitCount == bpp_filter || !bpp_filter)
@ -237,7 +237,7 @@ HRESULT dd_EnumDisplayModes(
s.ddpfPixelFormat.dwRBitMask = 0xF800;
s.ddpfPixelFormat.dwGBitMask = 0x07E0;
s.ddpfPixelFormat.dwBBitMask = 0x001F;
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 63) & ~63) >> 3;
if (s.ddpfPixelFormat.dwRGBBitCount == bpp_filter || !bpp_filter)
{
@ -262,7 +262,7 @@ HRESULT dd_EnumDisplayModes(
s.ddpfPixelFormat.dwRBitMask = 0xFF0000;
s.ddpfPixelFormat.dwGBitMask = 0x00FF00;
s.ddpfPixelFormat.dwBBitMask = 0x0000FF;
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 63) & ~63) >> 3;
if (s.ddpfPixelFormat.dwRGBBitCount == bpp_filter || !bpp_filter)
{
@ -331,7 +331,7 @@ HRESULT dd_EnumDisplayModes(
s.dwRefreshRate = 60;
s.dwHeight = resolutions[i].cy;
s.dwWidth = resolutions[i].cx;
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 63) & ~63) >> 3;
if (s.ddpfPixelFormat.dwRGBBitCount == bpp_filter || !bpp_filter)
{
@ -353,7 +353,7 @@ HRESULT dd_EnumDisplayModes(
s.ddpfPixelFormat.dwRBitMask = 0xF800;
s.ddpfPixelFormat.dwGBitMask = 0x07E0;
s.ddpfPixelFormat.dwBBitMask = 0x001F;
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 63) & ~63) >> 3;
if (s.ddpfPixelFormat.dwRGBBitCount == bpp_filter || !bpp_filter)
{
@ -378,7 +378,7 @@ HRESULT dd_EnumDisplayModes(
s.ddpfPixelFormat.dwRBitMask = 0xFF0000;
s.ddpfPixelFormat.dwGBitMask = 0x00FF00;
s.ddpfPixelFormat.dwBBitMask = 0x0000FF;
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 63) & ~63) >> 3;
if (s.ddpfPixelFormat.dwRGBBitCount == bpp_filter || !bpp_filter)
{
@ -481,7 +481,7 @@ HRESULT dd_GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc)
lpDDSurfaceDesc->dwWidth = g_ddraw->width ? g_ddraw->width : 1024;
lpDDSurfaceDesc->lPitch =
((lpDDSurfaceDesc->dwWidth * lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
((lpDDSurfaceDesc->dwWidth * lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount + 63) & ~63) >> 3;
if (g_ddraw->bpp == 32 || g_config.vermeer_hack)
{
@ -492,7 +492,7 @@ HRESULT dd_GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc)
lpDDSurfaceDesc->ddpfPixelFormat.dwBBitMask = 0x0000FF;
lpDDSurfaceDesc->lPitch =
((lpDDSurfaceDesc->dwWidth * lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
((lpDDSurfaceDesc->dwWidth * lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount + 63) & ~63) >> 3;
}
else if (g_ddraw->bpp != 8)
{
@ -503,7 +503,7 @@ HRESULT dd_GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc)
lpDDSurfaceDesc->ddpfPixelFormat.dwBBitMask = 0x001F;
lpDDSurfaceDesc->lPitch =
((lpDDSurfaceDesc->dwWidth * lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
((lpDDSurfaceDesc->dwWidth * lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount + 63) & ~63) >> 3;
}
}

View File

@ -1405,7 +1405,7 @@ HRESULT dd_CreateSurface(
else if (dst_surface->width && dst_surface->height)
{
dst_surface->bytes_pp = dst_surface->bpp / 8;
dst_surface->pitch = ((dst_surface->width * dst_surface->bpp + 31) & ~31) >> 3;
dst_surface->pitch = ((dst_surface->width * dst_surface->bpp + 63) & ~63) >> 3;
dst_surface->size = dst_surface->pitch * dst_surface->height;
DWORD aligned_width = dst_surface->pitch / dst_surface->bytes_pp;
@ -1429,7 +1429,7 @@ HRESULT dd_CreateSurface(
}
dst_surface->bmi->bmiHeader.biSizeImage =
((aligned_width * clr_bits + 31) & ~31) / 8 * dst_surface->height;
((aligned_width * clr_bits + 63) & ~63) / 8 * dst_surface->height;
if (dst_surface->bpp == 8)
{