Server/Shadow: Fix invalid ALIGN in shadow_client_send_bitmap_update

This commit is contained in:
zihao.jiang 2015-09-25 01:29:40 +08:00
parent 6d810a5d78
commit 86a3b30d25
2 changed files with 7 additions and 9 deletions

View File

@ -628,14 +628,12 @@ int shadow_client_send_bitmap_update(rdpShadowClient* client, rdpShadowSurface*
if ((nWidth % 4) != 0)
{
nXSrc -= (nWidth % 4);
nWidth += (nWidth % 4);
nWidth += (4 - (nWidth % 4));
}
if ((nHeight % 4) != 0)
{
nYSrc -= (nHeight % 4);
nHeight += (nHeight % 4);
nHeight += (4 - (nHeight % 4));
}
for (yIdx = 0; yIdx < rows; yIdx++)

View File

@ -23,7 +23,7 @@
#include "shadow.h"
#include "shadow_surface.h"
#define ALIGN_SCREEN_SIZE(size, align) ((size + align - 1) & (~(align - 1)))
rdpShadowSurface* shadow_surface_new(rdpShadowServer* server, int x, int y, int width, int height)
{
rdpShadowSurface* surface;
@ -39,9 +39,9 @@ rdpShadowSurface* shadow_surface_new(rdpShadowServer* server, int x, int y, int
surface->y = y;
surface->width = width;
surface->height = height;
surface->scanline = (surface->width + (surface->width % 4)) * 4;
surface->scanline = ALIGN_SCREEN_SIZE(surface->width, 4) * 4;
surface->data = (BYTE*) calloc(1, surface->scanline * surface->height);
surface->data = (BYTE*) calloc(1, surface->scanline * ALIGN_SCREEN_SIZE(surface->height, 4));
if (!surface->data)
{
free (surface);
@ -77,7 +77,7 @@ void shadow_surface_free(rdpShadowSurface* surface)
BOOL shadow_surface_resize(rdpShadowSurface *surface, int x, int y, int width, int height)
{
BYTE* buffer = NULL;
int scanline = (width + (width % 4)) * 4;
int scanline = ALIGN_SCREEN_SIZE(width, 4) * 4;
if (!surface)
return FALSE;
@ -90,7 +90,7 @@ BOOL shadow_surface_resize(rdpShadowSurface *surface, int x, int y, int width, i
return TRUE;
}
buffer = (BYTE*) realloc(surface->data, scanline * height);
buffer = (BYTE*) realloc(surface->data, scanline * ALIGN_SCREEN_SIZE(height, 4));
if (buffer)
{
surface->x = x;