added server_paint_rects

ulab-next
Jay Sorg 11 years ago
parent b0a1832186
commit 8cd57e0710

@ -402,6 +402,10 @@ server_composite(struct xrdp_mod* mod, int srcidx, int srcformat, int srcwidth,
int srcx, int srcy, int mskx, int msky, int srcx, int srcy, int mskx, int msky,
int dstx, int dsty, int width, int height, int dstformat); int dstx, int dsty, int width, int height, int dstformat);
int DEFAULT_CC int DEFAULT_CC
server_paint_rects(struct xrdp_mod* mod, int num_drects, short *drects,
int num_crects, short *crects,
char *data, int width, int height, int flags);
int DEFAULT_CC
server_set_pointer(struct xrdp_mod* mod, int x, int y, server_set_pointer(struct xrdp_mod* mod, int x, int y,
char* data, char* mask); char* data, char* mask);
int DEFAULT_CC int DEFAULT_CC

@ -417,6 +417,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
self->mod->server_create_os_surface_bpp = server_create_os_surface_bpp; self->mod->server_create_os_surface_bpp = server_create_os_surface_bpp;
self->mod->server_paint_rect_bpp = server_paint_rect_bpp; self->mod->server_paint_rect_bpp = server_paint_rect_bpp;
self->mod->server_composite = server_composite; self->mod->server_composite = server_composite;
self->mod->server_paint_rects = server_paint_rects;
} }
} }
@ -2136,6 +2137,38 @@ server_composite(struct xrdp_mod* mod, int srcidx, int srcformat,
return 0; return 0;
} }
/*****************************************************************************/
int DEFAULT_CC
server_paint_rects(struct xrdp_mod* mod, int num_drects, short *drects,
int num_crects, short *crects,
char *data, int width, int height, int flags)
{
struct xrdp_wm* wm;
struct xrdp_painter* p;
struct xrdp_bitmap *b;
short *s;
int index;
//g_writeln("server_paint_rects:");
wm = (struct xrdp_wm*)(mod->wm);
p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
b = xrdp_bitmap_create_with_data(width, height, wm->screen->bpp,
data, wm);
s = crects;
for (index = 0; index < num_crects; index++)
{
xrdp_painter_copy(p, b, wm->target_surface, s[0], s[1], s[2], s[3],
s[0], s[1]);
s += 4;
}
xrdp_bitmap_delete(b);
return 0;
}
/*****************************************************************************/ /*****************************************************************************/
int DEFAULT_CC int DEFAULT_CC
server_set_pointer(struct xrdp_mod *mod, int x, int y, server_set_pointer(struct xrdp_mod *mod, int x, int y,

@ -139,7 +139,11 @@ struct xrdp_mod
int srcx, int srcy, int mskx, int msky, int srcx, int srcy, int mskx, int msky,
int dstx, int dsty, int width, int height, int dstx, int dsty, int width, int height,
int dstformat); int dstformat);
long server_dumby[100 - 42]; /* align, 100 minus the number of server int (*server_paint_rects)(struct xrdp_mod* v,
int num_drects, short *drects,
int num_crects, short *crects,
char *data, int width, int height, int flags);
long server_dumby[100 - 43]; /* align, 100 minus the number of server
functions above */ functions above */
/* common */ /* common */
long handle; /* pointer to self as int */ long handle; /* pointer to self as int */

@ -1174,20 +1174,53 @@ send_paint_rect_ex_ack(struct mod *mod, int flags, int frame_id)
/******************************************************************************/ /******************************************************************************/
/* return error */ /* return error */
static int APP_CC static int APP_CC
process_server_paint_rect_shmem_ex(struct mod *mod, struct stream *s) process_server_paint_rect_shmem_ex(struct mod *amod, struct stream *s)
{ {
int num_rects; int num_drects;
int num_crects;
int flags; int flags;
int frame_id; int frame_id;
int shmem_id; int shmem_id;
int shmem_offset; int shmem_offset;
int width; int width;
int height; int height;
int x;
int y;
int cx;
int cy;
int index;
int rv;
tsi16 *ldrects;
tsi16 *ldrects1;
tsi16 *lcrects;
tsi16 *lcrects1;
char *bmpdata;
in_uint16_le(s, num_rects); /* dirty pixels */
in_uint8s(s, num_rects * 8); in_uint16_le(s, num_drects);
in_uint16_le(s, num_rects); ldrects = (tsi16 *) g_malloc(2 * 4 * num_drects, 0);
in_uint8s(s, num_rects * 8); ldrects1 = ldrects;
for (index = 0; index < num_drects; index++)
{
in_sint16_le(s, ldrects1[0]);
in_sint16_le(s, ldrects1[1]);
in_sint16_le(s, ldrects1[2]);
in_sint16_le(s, ldrects1[3]);
ldrects1 += 4;
}
/* copied pixels */
in_uint16_le(s, num_crects);
lcrects = (tsi16 *) g_malloc(2 * 4 * num_crects, 0);
lcrects1 = lcrects;
for (index = 0; index < num_crects; index++)
{
in_sint16_le(s, lcrects1[0]);
in_sint16_le(s, lcrects1[1]);
in_sint16_le(s, lcrects1[2]);
in_sint16_le(s, lcrects1[3]);
lcrects1 += 4;
}
in_uint32_le(s, flags); in_uint32_le(s, flags);
in_uint32_le(s, frame_id); in_uint32_le(s, frame_id);
@ -1197,7 +1230,35 @@ process_server_paint_rect_shmem_ex(struct mod *mod, struct stream *s)
in_uint16_le(s, width); in_uint16_le(s, width);
in_uint16_le(s, height); in_uint16_le(s, height);
send_paint_rect_ex_ack(mod, flags, frame_id); bmpdata = 0;
if (flags == 0) /* screen */
{
if (amod->screen_shmem_id == 0)
{
amod->screen_shmem_id = shmem_id;
amod->screen_shmem_pixels = g_shmat(amod->screen_shmem_id);
}
if (amod->screen_shmem_pixels != 0)
{
bmpdata = amod->screen_shmem_pixels + shmem_offset;
}
}
if (bmpdata != 0)
{
rv = amod->server_paint_rects(amod, num_drects, ldrects,
num_crects, lcrects,
bmpdata, width, height, 0);
}
else
{
rv = 1;
}
send_paint_rect_ex_ack(amod, flags, frame_id);
g_free(lcrects);
g_free(ldrects);
return 0; return 0;
} }

@ -133,8 +133,12 @@ struct mod
int mskformat, int mskwidth, int mskrepeat, int op, int mskformat, int mskwidth, int mskrepeat, int op,
int srcx, int srcy, int mskx, int msky, int srcx, int srcy, int mskx, int msky,
int dstx, int dsty, int width, int height, int dstformat); int dstx, int dsty, int width, int height, int dstformat);
int (*server_paint_rects)(struct mod* v,
int num_drects, short *drects,
int num_crects, short *crects,
char *data, int width, int height, int flags);
tbus server_dumby[100 - 42]; /* align, 100 minus the number of server tbus server_dumby[100 - 43]; /* align, 100 minus the number of server
functions above */ functions above */
/* common */ /* common */
tbus handle; /* pointer to self as long */ tbus handle; /* pointer to self as long */

Loading…
Cancel
Save