Scanline alignment for GFX cache.
This commit is contained in:
parent
f62d00445e
commit
95a3144b34
@ -29,6 +29,18 @@
|
|||||||
|
|
||||||
#define TAG FREERDP_TAG("gdi")
|
#define TAG FREERDP_TAG("gdi")
|
||||||
|
|
||||||
|
static DWORD gfx_align_scanline(DWORD widthInBytes, DWORD alignment)
|
||||||
|
{
|
||||||
|
const UINT32 align = 16;
|
||||||
|
const UINT32 pad = align - (widthInBytes % alignment);
|
||||||
|
UINT32 scanline = widthInBytes;
|
||||||
|
|
||||||
|
if (align != pad)
|
||||||
|
scanline += pad;
|
||||||
|
|
||||||
|
return scanline;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function description
|
* Function description
|
||||||
*
|
*
|
||||||
@ -698,16 +710,8 @@ static UINT gdi_CreateSurface(RdpgfxClientContext* context,
|
|||||||
return ERROR_INTERNAL_ERROR;
|
return ERROR_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->scanline = surface->width * 4;
|
surface->scanline = gfx_align_scanline(surface->width * 4, 16);
|
||||||
{
|
surface->data = (BYTE*) calloc(1, surface->scanline * surface->height);
|
||||||
const UINT32 align = 16;
|
|
||||||
const UINT32 pad = align - (surface->scanline % align);
|
|
||||||
|
|
||||||
if (align != pad)
|
|
||||||
surface->scanline += pad;
|
|
||||||
|
|
||||||
surface->data = (BYTE*) calloc(1, surface->scanline * surface->height);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!surface->data)
|
if (!surface->data)
|
||||||
{
|
{
|
||||||
@ -895,7 +899,7 @@ static UINT gdi_SurfaceToCache(RdpgfxClientContext* context,
|
|||||||
cacheEntry->width = (UINT32)(rect->right - rect->left);
|
cacheEntry->width = (UINT32)(rect->right - rect->left);
|
||||||
cacheEntry->height = (UINT32)(rect->bottom - rect->top);
|
cacheEntry->height = (UINT32)(rect->bottom - rect->top);
|
||||||
cacheEntry->format = surface->format;
|
cacheEntry->format = surface->format;
|
||||||
cacheEntry->scanline = (cacheEntry->width + (cacheEntry->width % 4)) * 4;
|
cacheEntry->scanline = gfx_align_scanline(cacheEntry->width * 4, 16);
|
||||||
cacheEntry->data = (BYTE*) calloc(1, cacheEntry->scanline * cacheEntry->height);
|
cacheEntry->data = (BYTE*) calloc(1, cacheEntry->scanline * cacheEntry->height);
|
||||||
|
|
||||||
if (!cacheEntry->data)
|
if (!cacheEntry->data)
|
||||||
|
Loading…
Reference in New Issue
Block a user