summaryrefslogtreecommitdiffstats
path: root/xrdp/xrdp_cache.c
diff options
context:
space:
mode:
authorjsorg71 <jsorg71>2005-01-14 03:59:36 +0000
committerjsorg71 <jsorg71>2005-01-14 03:59:36 +0000
commit520301d70aafd53287b0f4d153a2b27dc025ea76 (patch)
treeb3bdd74bba8fa0989b703272581fd2c466c6b4cf /xrdp/xrdp_cache.c
parent1d03bafb9e8ff4cef59b041235a986d6e4ae2fce (diff)
downloadxrdp-proprietary-520301d70aafd53287b0f4d153a2b27dc025ea76.tar.gz
xrdp-proprietary-520301d70aafd53287b0f4d153a2b27dc025ea76.zip
set bitmap cache and bitmap compression from the config file
Diffstat (limited to 'xrdp/xrdp_cache.c')
-rw-r--r--xrdp/xrdp_cache.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/xrdp/xrdp_cache.c b/xrdp/xrdp_cache.c
index 55ffaf42..644b98c2 100644
--- a/xrdp/xrdp_cache.c
+++ b/xrdp/xrdp_cache.c
@@ -24,13 +24,21 @@
/*****************************************************************************/
struct xrdp_cache* xrdp_cache_create(struct xrdp_wm* owner,
- struct xrdp_orders* orders)
+ struct xrdp_orders* orders,
+ struct xrdp_client_info* client_info)
{
struct xrdp_cache* self;
self = (struct xrdp_cache*)g_malloc(sizeof(struct xrdp_cache), 1);
self->wm = owner;
self->orders = orders;
+ self->use_bitmap_comp = client_info->use_bitmap_comp;
+ self->cache1_entries = client_info->cache1_entries;
+ self->cache1_size = client_info->cache1_size;
+ self->cache2_entries = client_info->cache2_entries;
+ self->cache2_size = client_info->cache2_size;
+ self->cache3_entries = client_info->cache3_entries;
+ self->cache3_size = client_info->cache3_size;
return self;
}
@@ -41,15 +49,25 @@ void xrdp_cache_delete(struct xrdp_cache* self)
int j;
if (self == 0)
+ {
return;
+ }
/* free all the cached bitmaps */
for (i = 0; i < 3; i++)
+ {
for (j = 0; j < 600; j++)
+ {
xrdp_bitmap_delete(self->bitmap_items[i][j].bitmap);
+ }
+ }
/* free all the cached font items */
for (i = 0; i < 12; i++)
+ {
for (j = 0; j < 256; j++)
+ {
g_free(self->char_items[i][j].font_item.data);
+ }
+ }
g_free(self);
}
@@ -80,7 +98,11 @@ int xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap)
i = 0;
for (j = 0; j < self->cache1_entries; j++)
{
+#ifdef USE_CRC
if (xrdp_bitmap_compare_with_crc(self->bitmap_items[i][j].bitmap, bitmap))
+#else
+ if (xrdp_bitmap_compare(self->bitmap_items[i][j].bitmap, bitmap))
+#endif
{
self->bitmap_items[i][j].stamp = self->bitmap_stamp;
DEBUG(("found bitmap at %d %d\n\r", i, j));
@@ -95,7 +117,11 @@ int xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap)
i = 1;
for (j = 0; j < self->cache2_entries; j++)
{
+#ifdef USE_CRC
if (xrdp_bitmap_compare_with_crc(self->bitmap_items[i][j].bitmap, bitmap))
+#else
+ if (xrdp_bitmap_compare(self->bitmap_items[i][j].bitmap, bitmap))
+#endif
{
self->bitmap_items[i][j].stamp = self->bitmap_stamp;
DEBUG(("found bitmap at %d %d\n\r", i, j));
@@ -110,7 +136,11 @@ int xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap)
i = 2;
for (j = 0; j < self->cache3_entries; j++)
{
+#ifdef USE_CRC
if (xrdp_bitmap_compare_with_crc(self->bitmap_items[i][j].bitmap, bitmap))
+#else
+ if (xrdp_bitmap_compare(self->bitmap_items[i][j].bitmap, bitmap))
+#endif
{
self->bitmap_items[i][j].stamp = self->bitmap_stamp;
DEBUG(("found bitmap at %d %d\n\r", i, j));
@@ -120,6 +150,10 @@ int xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap)
}
}
}
+ else
+ {
+ g_printf("error in xrdp_cache_add_bitmap, too big\n\r");
+ }
/* look for oldest */
cache_id = 0;
cache_idx = 0;