wined3d: Use SURFACE_ALIGNMENT.

This commit is contained in:
Markus Amsler 2006-11-06 19:43:48 +01:00 committed by Alexandre Julliard
parent 02cd4c8584
commit 5864d18c96
1 changed files with 2 additions and 2 deletions

View File

@ -1842,7 +1842,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) {
/* Stick to the alignment for the converted surface too, makes it easier to load the surface */ /* Stick to the alignment for the converted surface too, makes it easier to load the surface */
outpitch = width * bpp; outpitch = width * bpp;
outpitch = (outpitch + 3) & ~3; outpitch = (outpitch + SURFACE_ALIGNMENT - 1) & ~(SURFACE_ALIGNMENT - 1);
mem = HeapAlloc(GetProcessHeap(), 0, outpitch * height); mem = HeapAlloc(GetProcessHeap(), 0, outpitch * height);
if(!mem) { if(!mem) {
@ -2126,7 +2126,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3DFORM
format == WINED3DFMT_DXT4 || format == WINED3DFMT_DXT5) { format == WINED3DFMT_DXT4 || format == WINED3DFMT_DXT5) {
This->resource.size = ((max(This->pow2Width, 4) * formatEntry->bpp) * max(This->pow2Height, 4)); This->resource.size = ((max(This->pow2Width, 4) * formatEntry->bpp) * max(This->pow2Height, 4));
} else { } else {
This->resource.size = ((This->pow2Width * formatEntry->bpp) + 3) & ~3; This->resource.size = ((This->pow2Width * formatEntry->bpp) + SURFACE_ALIGNMENT - 1) & ~(SURFACE_ALIGNMENT - 1);
This->resource.size *= This->pow2Height; This->resource.size *= This->pow2Height;
} }