diff options
author | jsorg71 <jsorg71> | 2008-06-24 05:43:10 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2008-06-24 05:43:10 +0000 |
commit | bfe555e3b6ad96df9ab45365305d1ef463c3f015 (patch) | |
tree | 7be1450fb6430acfc82566caedb6f83620c5e0d8 /xrdp | |
parent | 756fcef1c8e4748b4a0c5b616d7afd7347aa6d5d (diff) | |
download | xrdp-proprietary-bfe555e3b6ad96df9ab45365305d1ef463c3f015.tar.gz xrdp-proprietary-bfe555e3b6ad96df9ab45365305d1ef463c3f015.zip |
added brush cache bits for clients that support it
Diffstat (limited to 'xrdp')
-rw-r--r-- | xrdp/xrdp.h | 3 | ||||
-rw-r--r-- | xrdp/xrdp_cache.c | 46 | ||||
-rw-r--r-- | xrdp/xrdp_painter.c | 26 | ||||
-rw-r--r-- | xrdp/xrdp_types.h | 10 |
4 files changed, 84 insertions, 1 deletions
diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h index e41c050a..2d804106 100644 --- a/xrdp/xrdp.h +++ b/xrdp/xrdp.h @@ -72,6 +72,9 @@ int APP_CC xrdp_cache_add_pointer_static(struct xrdp_cache* self, struct xrdp_pointer_item* pointer_item, int index); +int APP_CC +xrdp_cache_add_brush(struct xrdp_cache* self, + char* brush_item_data); /* xrdp_wm.c */ struct xrdp_wm* APP_CC diff --git a/xrdp/xrdp_cache.c b/xrdp/xrdp_cache.c index ad59403a..d92cdab6 100644 --- a/xrdp/xrdp_cache.c +++ b/xrdp/xrdp_cache.c @@ -486,3 +486,49 @@ xrdp_cache_add_pointer_static(struct xrdp_cache* self, DEBUG(("adding pointer at %d", index)); return index; } + +/*****************************************************************************/ +/* this does not take owership of brush_item_data, it makes a copy */ +int APP_CC +xrdp_cache_add_brush(struct xrdp_cache* self, + char* brush_item_data) +{ + int i; + int oldest; + int index; + + if (self == 0) + { + return 0; + } + self->brush_stamp++; + /* look for match */ + for (i = 0; i < 64; i++) + { + if (g_memcmp(self->brush_items[i].pattern, + brush_item_data, 8) == 0) + { + self->brush_items[i].stamp = self->brush_stamp; + DEBUG(("found brush at %d", i)); + return i; + } + } + /* look for oldest */ + index = 0; + oldest = 0x7fffffff; + for (i = 0; i < 64; i++) + { + if (self->brush_items[i].stamp < oldest) + { + oldest = self->brush_items[i].stamp; + index = i; + } + } + g_memcpy(self->brush_items[index].pattern, + brush_item_data, 8); + self->brush_items[index].stamp = self->brush_stamp; + libxrdp_orders_send_brush(self->session, 8, 8, 1, 0x81, 8, + self->brush_items[index].pattern, index); + DEBUG(("adding brush at %d", index)); + return index; +} diff --git a/xrdp/xrdp_painter.c b/xrdp/xrdp_painter.c index 564054bb..f68627d1 100644 --- a/xrdp/xrdp_painter.c +++ b/xrdp/xrdp_painter.c @@ -230,6 +230,28 @@ xrdp_painter_text_height(struct xrdp_painter* self, char* text) } /*****************************************************************************/ +static int APP_CC +xrdp_painter_setup_brush(struct xrdp_painter* self, + struct xrdp_brush* out_brush, + struct xrdp_brush* in_brush) +{ + int cache_id; + + g_memcpy(out_brush, in_brush, sizeof(struct xrdp_brush)); + if (in_brush->style == 3) + { + if (self->session->client_info->brush_cache_code == 1) + { + cache_id = xrdp_cache_add_brush(self->wm->cache, in_brush->pattern); + g_memset(out_brush->pattern, 0, 8); + out_brush->pattern[0] = cache_id; + out_brush->style = 0x81; + } + } + return 0; +} + +/*****************************************************************************/ /* fill in an area of the screen with one color */ int APP_CC xrdp_painter_fill_rect(struct xrdp_painter* self, @@ -240,6 +262,7 @@ xrdp_painter_fill_rect(struct xrdp_painter* self, struct xrdp_rect draw_rect; struct xrdp_rect rect; struct xrdp_region* region; + struct xrdp_brush brush; int k; int dx; int dy; @@ -314,13 +337,14 @@ xrdp_painter_fill_rect(struct xrdp_painter* self, break; } } + xrdp_painter_setup_brush(self, &brush, &self->brush); while (xrdp_region_get_rect(region, k, &rect) == 0) { if (rect_intersect(&rect, &clip_rect, &draw_rect)) { libxrdp_orders_pat_blt(self->session, x, y, cx, cy, rop, self->bg_color, self->fg_color, - &self->brush, &draw_rect); + &brush, &draw_rect); } k++; } diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index 20884b1b..7d2b2b7c 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -130,6 +130,14 @@ struct xrdp_pointer_item char mask[32 * 32 / 8]; }; +struct xrdp_brush_item +{ + int stamp; + /* expand this to a structure to handle more complicated brushes + for now its 8x8 1bpp brushes only */ + char pattern[8]; +}; + /* differnce caches */ struct xrdp_cache { @@ -157,6 +165,8 @@ struct xrdp_cache int pointer_stamp; struct xrdp_pointer_item pointer_items[32]; int pointer_cache_entries; + int brush_stamp; + struct xrdp_brush_item brush_items[64]; }; struct xrdp_mm |