Fix Parallels Client on Mac

self->line_size should be calculated in xrdp_bitmap_create_with_data()

The code was in the original noorders branch but got lost. Without this
fix, the image is garbled.

The client should be configured with compression disabled, or it will
disconnect. That's a known problem.
master
Pavel Roskin 8 years ago
parent 2d8d786a9d
commit 77d6fd0807

@ -149,9 +149,9 @@ xrdp_bitmap_create_with_data(int width, int height,
struct xrdp_wm *wm) struct xrdp_wm *wm)
{ {
struct xrdp_bitmap *self = (struct xrdp_bitmap *)NULL; struct xrdp_bitmap *self = (struct xrdp_bitmap *)NULL;
int Bpp;
#if defined(NEED_ALIGN) #if defined(NEED_ALIGN)
tintptr data_as_int; tintptr data_as_int;
int Bpp;
#endif #endif
self = (struct xrdp_bitmap *)g_malloc(sizeof(struct xrdp_bitmap), 1); self = (struct xrdp_bitmap *)g_malloc(sizeof(struct xrdp_bitmap), 1);
@ -160,13 +160,7 @@ xrdp_bitmap_create_with_data(int width, int height,
self->height = height; self->height = height;
self->bpp = bpp; self->bpp = bpp;
self->wm = wm; self->wm = wm;
#if defined(NEED_ALIGN)
data_as_int = (tintptr) data;
if (((bpp >= 24) && (data_as_int & 3)) ||
(((bpp == 15) || (bpp == 16)) && (data_as_int & 1)))
{
/* got to copy data here, it's not aligned
other calls in this file assume alignment */
Bpp = 4; Bpp = 4;
switch (bpp) switch (bpp)
{ {
@ -180,6 +174,15 @@ xrdp_bitmap_create_with_data(int width, int height,
Bpp = 2; Bpp = 2;
break; break;
} }
self->line_size = width * Bpp;
#if defined(NEED_ALIGN)
data_as_int = (tintptr) data;
if (((bpp >= 24) && (data_as_int & 3)) ||
(((bpp == 15) || (bpp == 16)) && (data_as_int & 1)))
{
/* got to copy data here, it's not aligned
other calls in this file assume alignment */
self->data = (char *)g_malloc(width * height * Bpp, 0); self->data = (char *)g_malloc(width * height * Bpp, 0);
g_memcpy(self->data, data, width * height * Bpp); g_memcpy(self->data, data, width * height * Bpp);
return self; return self;

Loading…
Cancel
Save