diff options
Diffstat (limited to 'xrdp')
-rw-r--r-- | xrdp/xrdp.h | 27 | ||||
-rw-r--r-- | xrdp/xrdp_cache.c | 2 | ||||
-rw-r--r-- | xrdp/xrdp_mm.c | 102 | ||||
-rw-r--r-- | xrdp/xrdp_painter.c | 82 | ||||
-rw-r--r-- | xrdp/xrdp_types.h | 20 |
5 files changed, 226 insertions, 7 deletions
diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h index 44246984..4215c27b 100644 --- a/xrdp/xrdp.h +++ b/xrdp/xrdp.h @@ -283,6 +283,20 @@ xrdp_painter_copy(struct xrdp_painter* self, int x, int y, int cx, int cy, int srcx, int srcy); int APP_CC +xrdp_painter_composite(struct xrdp_painter* self, + struct xrdp_bitmap* src, + int srcformat, + int srcwidth, + int srcrepeat, + struct xrdp_bitmap* dst, + int* srctransform, + int mskflags, + struct xrdp_bitmap* msk, + int mskformat, int mskwidth, int mskrepeat, int op, + int srcx, int srcy, int mskx, int msky, + int dstx, int dsty, int width, int height, + int dstformat); +int APP_CC xrdp_painter_line(struct xrdp_painter* self, struct xrdp_bitmap* bitmap, int x1, int y1, int x2, int y2); @@ -374,6 +388,16 @@ int DEFAULT_CC server_paint_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy, char* data, int width, int height, int srcx, int srcy); int DEFAULT_CC +server_paint_rect_bpp(struct xrdp_mod* mod, int x, int y, int cx, int cy, + char* data, int width, int height, int srcx, int srcy, + int bpp); +int DEFAULT_CC +server_composite(struct xrdp_mod* mod, int srcidx, int srcformat, int srcwidth, + int srcrepeat, int* srctransform, int mskflags, int mskidx, + int mskformat, int mskwidth, int mskrepeat, int op, + int srcx, int srcy, int mskx, int msky, + int dstx, int dsty, int width, int height, int dstformat); +int DEFAULT_CC server_set_pointer(struct xrdp_mod* mod, int x, int y, char* data, char* mask); int DEFAULT_CC @@ -434,6 +458,9 @@ int DEFAULT_CC server_create_os_surface(struct xrdp_mod* mod, int id, int width, int height); int DEFAULT_CC +server_create_os_surface_bpp(struct xrdp_mod* mod, int id, + int width, int height, int bpp); +int DEFAULT_CC server_switch_os_surface(struct xrdp_mod* mod, int id); int DEFAULT_CC server_delete_os_surface(struct xrdp_mod* mod, int id); diff --git a/xrdp/xrdp_cache.c b/xrdp/xrdp_cache.c index 62da4183..16ce1283 100644 --- a/xrdp/xrdp_cache.c +++ b/xrdp/xrdp_cache.c @@ -239,7 +239,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap, } else { - log_message(LOG_LEVEL_ERROR,"error in xrdp_cache_add_bitmap, too big(%d)", bmp_size); + log_message(LOG_LEVEL_ERROR,"error in xrdp_cache_add_bitmap, too big(%d) bpp %d", bmp_size, bitmap->bpp); } /* look for oldest */ diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 88f888c7..b1499984 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -414,6 +414,9 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self) self->mod->server_notify_delete = server_notify_delete; self->mod->server_monitored_desktop = server_monitored_desktop; self->mod->server_add_char_alpha = server_add_char_alpha; + 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_composite = server_composite; } } @@ -906,7 +909,6 @@ xrdp_mm_process_rail_drawing_orders(struct xrdp_mm* self, struct trans* trans) struct stream* s; int order_type; int rv = 0; - struct rail_window_state_order rwso; s = trans_get_in_s(trans); if (s == 0) @@ -1057,7 +1059,7 @@ xrdp_mm_connect_chansrv(struct xrdp_mm *self, char *ip, char *port) self->usechansrv = 1; /* connect channel redir */ - if ((ip == 0) || (g_strcmp(ip, "127.0.0.1") == 0) || (ip[0] == 0)) + if ((g_strcmp(ip, "127.0.0.1") == 0) || (ip[0] == 0)) { /* unix socket */ self->chan_trans = trans_create(TRANS_MODE_UNIX, 8192, 8192); @@ -2060,6 +2062,79 @@ server_paint_rect(struct xrdp_mod *mod, int x, int y, int cx, int cy, /*****************************************************************************/ int DEFAULT_CC +server_paint_rect_bpp(struct xrdp_mod* mod, int x, int y, int cx, int cy, + char* data, int width, int height, int srcx, int srcy, + int bpp) +{ + struct xrdp_wm* wm; + struct xrdp_bitmap* b; + struct xrdp_painter* p; + + p = (struct xrdp_painter*)(mod->painter); + if (p == 0) + { + return 0; + } + wm = (struct xrdp_wm*)(mod->wm); + b = xrdp_bitmap_create_with_data(width, height, bpp, data, wm); + xrdp_painter_copy(p, b, wm->target_surface, x, y, cx, cy, srcx, srcy); + xrdp_bitmap_delete(b); + return 0; +} + +/*****************************************************************************/ +int DEFAULT_CC +server_composite(struct xrdp_mod* mod, int srcidx, int srcformat, + int srcwidth, int srcrepeat, int* srctransform, + int mskflags, int mskidx, int mskformat, int mskwidth, + int mskrepeat, int op, int srcx, int srcy, + int mskx, int msky, int dstx, int dsty, + int width, int height, int dstformat) +{ + struct xrdp_wm* wm; + struct xrdp_bitmap* b; + struct xrdp_bitmap* msk; + struct xrdp_painter* p; + struct xrdp_os_bitmap_item* bi; + + p = (struct xrdp_painter*)(mod->painter); + if (p == 0) + { + return 0; + } + wm = (struct xrdp_wm*)(mod->wm); + b = 0; + msk = 0; + bi = xrdp_cache_get_os_bitmap(wm->cache, srcidx); + if (bi != 0) + { + b = bi->bitmap; + } + if (mskflags & 1) + { + bi = xrdp_cache_get_os_bitmap(wm->cache, mskidx); + if (bi != 0) + { + msk = bi->bitmap; + } + } + if (b != 0) + { + xrdp_painter_composite(p, b, srcformat, srcwidth, srcrepeat, + wm->target_surface, srctransform, + mskflags, msk, mskformat, mskwidth, mskrepeat, + op, srcx, srcy, mskx, msky, dstx, dsty, + width, height, dstformat); + } + else + { + g_writeln("server_composite: error finding id %d or %d", srcidx, mskidx); + } + return 0; +} + +/*****************************************************************************/ +int DEFAULT_CC server_set_pointer(struct xrdp_mod *mod, int x, int y, char *data, char *mask) { @@ -2675,6 +2750,29 @@ server_create_os_surface(struct xrdp_mod *mod, int rdpindex, /*****************************************************************************/ int DEFAULT_CC +server_create_os_surface_bpp(struct xrdp_mod* mod, int rdpindex, + int width, int height, int bpp) +{ + struct xrdp_wm* wm; + struct xrdp_bitmap* bitmap; + int error; + + wm = (struct xrdp_wm*)(mod->wm); + bitmap = xrdp_bitmap_create(width, height, bpp, + WND_TYPE_OFFSCREEN, wm); + error = xrdp_cache_add_os_bitmap(wm->cache, bitmap, rdpindex); + if (error != 0) + { + g_writeln("server_create_os_surface_bpp: xrdp_cache_add_os_bitmap failed"); + return 1; + } + bitmap->item_index = rdpindex; + bitmap->id = rdpindex; + return 0; +} + +/*****************************************************************************/ +int DEFAULT_CC server_switch_os_surface(struct xrdp_mod *mod, int rdpindex) { struct xrdp_wm *wm; diff --git a/xrdp/xrdp_painter.c b/xrdp/xrdp_painter.c index 4457fee8..b9d1da16 100644 --- a/xrdp/xrdp_painter.c +++ b/xrdp/xrdp_painter.c @@ -849,7 +849,7 @@ xrdp_painter_copy(struct xrdp_painter *self, { w = MIN(64, ((srcx + cx) - i)); h = MIN(64, ((srcy + cy) - j)); - b = xrdp_bitmap_create(w, h, self->wm->screen->bpp, 0, self->wm); + b = xrdp_bitmap_create(w, h, src->bpp, 0, self->wm); xrdp_bitmap_copy_box_with_crc(src, b, i, j, w, h); bitmap_id = xrdp_cache_add_bitmap(self->wm->cache, b, self->wm->hints); cache_id = HIWORD(bitmap_id); @@ -889,6 +889,86 @@ xrdp_painter_copy(struct xrdp_painter *self, /*****************************************************************************/ int APP_CC +xrdp_painter_composite(struct xrdp_painter* self, + struct xrdp_bitmap* src, + int srcformat, + int srcwidth, + int srcrepeat, + struct xrdp_bitmap* dst, + int* srctransform, + int mskflags, + struct xrdp_bitmap* msk, + int mskformat, int mskwidth, int mskrepeat, int op, + int srcx, int srcy, int mskx, int msky, + int dstx, int dsty, int width, int height, int dstformat) +{ + struct xrdp_rect clip_rect; + struct xrdp_rect draw_rect; + struct xrdp_rect rect1; + struct xrdp_rect rect2; + struct xrdp_region* region; + int k; + int dx; + int dy; + int palette_id; + int cache_srcidx; + int cache_mskidx; + + if (self == 0 || src == 0 || dst == 0) + { + return 0; + } + + /* todo data */ + + if (dst->type == WND_TYPE_BITMAP) + { + return 0; + } + + if (src->type == WND_TYPE_OFFSCREEN) + { + xrdp_bitmap_get_screen_clip(dst, self, &clip_rect, &dx, &dy); + region = xrdp_region_create(self->wm); + xrdp_region_add_rect(region, &clip_rect); + dstx += dx; + dsty += dy; + + palette_id = 0; + cache_srcidx = src->item_index; + cache_mskidx = -1; + if (mskflags & 1) + { + if (msk != 0) + { + cache_mskidx = msk->item_index; // todo + } + } + + k = 0; + while (xrdp_region_get_rect(region, k, &rect1) == 0) + { + if (rect_intersect(&rect1, &clip_rect, &rect2)) + { + MAKERECT(rect1, dstx, dsty, width, height); + if (rect_intersect(&rect2, &rect1, &draw_rect)) + { + libxrdp_orders_composite_blt(self->session, cache_srcidx, srcformat, srcwidth, + srcrepeat, srctransform, mskflags, cache_mskidx, + mskformat, mskwidth, mskrepeat, op, srcx, srcy, + mskx, msky, dstx, dsty, width, height, dstformat, + &draw_rect); + } + } + k++; + } + xrdp_region_delete(region); + } + return 0; +} + +/*****************************************************************************/ +int APP_CC xrdp_painter_line(struct xrdp_painter *self, struct xrdp_bitmap *dst, int x1, int y1, int x2, int y2) diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index 7f08b4a0..14ae2237 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -52,8 +52,10 @@ struct xrdp_mod int (*server_screen_blt)(struct xrdp_mod* v, int x, int y, int cx, int cy, int srcx, int srcy); int (*server_paint_rect)(struct xrdp_mod* v, int x, int y, int cx, int cy, - char* data, int width, int height, int srcx, int srcy); - int (*server_set_pointer)(struct xrdp_mod* v, int x, int y, char* data, char* mask); + char* data, int width, int height, + int srcx, int srcy); + int (*server_set_pointer)(struct xrdp_mod* v, int x, int y, + char* data, char* mask); int (*server_palette)(struct xrdp_mod* v, int* palette); int (*server_msg)(struct xrdp_mod* v, char* msg, int code); int (*server_is_term)(struct xrdp_mod* v); @@ -122,7 +124,19 @@ struct xrdp_mod int offset, int baseline, int width, int height, char* data); - long server_dumby[100 - 39]; /* align, 100 minus the number of server + int (*server_create_os_surface_bpp)(struct xrdp_mod* v, int rdpindex, + int width, int height, int bpp); + int (*server_paint_rect_bpp)(struct xrdp_mod* v, int x, int y, int cx, int cy, + char* data, int width, int height, + int srcx, int srcy, int bpp); + int (*server_composite)(struct xrdp_mod* v, int srcidx, int srcformat, + int srcwidth, int srcrepeat, int* srctransform, + int mskflags, int mskidx, int mskformat, + int mskwidth, int mskrepeat, int op, + int srcx, int srcy, int mskx, int msky, + int dstx, int dsty, int width, int height, + int dstformat); + long server_dumby[100 - 42]; /* align, 100 minus the number of server functions above */ /* common */ long handle; /* pointer to self as int */ |