summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2012-05-13 14:40:14 -0700
committerJay Sorg <jay.sorg@gmail.com>2012-05-13 14:40:14 -0700
commit76e070e4f141c868fd4a4432985028c6a67bc643 (patch)
tree6cc4d9c9b9e1cc5f41e7ac453672d45f2cf692ac
parente8d2e4b6ad7538fc8f87bbe285d7d2a2413a734e (diff)
downloadxrdp-proprietary-76e070e4f141c868fd4a4432985028c6a67bc643.tar.gz
xrdp-proprietary-76e070e4f141c868fd4a4432985028c6a67bc643.zip
started work on off screen bitmap support
-rw-r--r--libxrdp/libxrdp.h5
-rw-r--r--libxrdp/xrdp_orders.c42
-rw-r--r--xrdp/xrdp.h7
-rw-r--r--xrdp/xrdp_cache.c80
-rw-r--r--xrdp/xrdp_types.h7
5 files changed, 141 insertions, 0 deletions
diff --git a/libxrdp/libxrdp.h b/libxrdp/libxrdp.h
index 6b105676..35a38190 100644
--- a/libxrdp/libxrdp.h
+++ b/libxrdp/libxrdp.h
@@ -387,6 +387,11 @@ xrdp_orders_send_bitmap2(struct xrdp_orders* self,
int APP_CC
xrdp_orders_send_brush(struct xrdp_orders* self, int width, int height,
int bpp, int type, int size, char* data, int cache_id);
+int APP_CC
+xrdp_orders_send_create_os_surface(struct xrdp_orders* self, int id,
+ int width, int height);
+int APP_CC
+xrdp_orders_send_switch_os_surface(struct xrdp_orders* self, int id);
/* xrdp_bitmap_compress.c */
int APP_CC
diff --git a/libxrdp/xrdp_orders.c b/libxrdp/xrdp_orders.c
index 17a06a7e..925c52aa 100644
--- a/libxrdp/xrdp_orders.c
+++ b/libxrdp/xrdp_orders.c
@@ -1965,3 +1965,45 @@ xrdp_orders_send_brush(struct xrdp_orders* self, int width, int height,
out_uint8a(self->out_s, data, size);
return 0;
}
+
+/*****************************************************************************/
+/* returns error */
+/* send an off screen bitmap entry */
+int APP_CC
+xrdp_orders_send_create_os_surface(struct xrdp_orders* self, int id,
+ int width, int height)
+{
+ int order_flags;
+ int cache_id;
+
+ g_writeln("xrdp_orders_send_create_os_surface:");
+ xrdp_orders_check(self, 7);
+ self->order_count++;
+ order_flags = RDP_ORDER_SECONDARY;
+ order_flags |= 1 << 2; /* type RDP_ORDER_ALTSEC_CREATE_OFFSCR_BITMAP */
+ out_uint8(self->out_s, order_flags);
+ cache_id = id & 0x7fff;
+ out_uint16_le(self->out_s, cache_id);
+ out_uint16_le(self->out_s, width);
+ out_uint16_le(self->out_s, height);
+ return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+int APP_CC
+xrdp_orders_send_switch_os_surface(struct xrdp_orders* self, int id)
+{
+ int order_flags;
+ int cache_id;
+
+ g_writeln("xrdp_orders_send_switch_os_surface:");
+ xrdp_orders_check(self, 3);
+ self->order_count++;
+ order_flags = RDP_ORDER_SECONDARY;
+ order_flags |= 0 << 2; /* type RDP_ORDER_ALTSEC_SWITCH_SURFACE */
+ out_uint8(self->out_s, order_flags);
+ cache_id = id & 0xffff;
+ out_uint16_le(self->out_s, cache_id);
+ return 0;
+}
diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h
index 2bc3c8b0..14be3767 100644
--- a/xrdp/xrdp.h
+++ b/xrdp/xrdp.h
@@ -80,6 +80,13 @@ xrdp_cache_add_pointer_static(struct xrdp_cache* self,
int APP_CC
xrdp_cache_add_brush(struct xrdp_cache* self,
char* brush_item_data);
+int APP_CC
+xrdp_cache_add_os_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap,
+ int id);
+int APP_CC
+xrdp_cache_remove_os_bitmap(struct xrdp_cache* self, int id);
+struct xrdp_os_bitmap_item* APP_CC
+xrdp_cache_get_os_bitmap(struct xrdp_cache* self, int id);
/* xrdp_wm.c */
struct xrdp_wm* APP_CC
diff --git a/xrdp/xrdp_cache.c b/xrdp/xrdp_cache.c
index 83e91ed9..88180491 100644
--- a/xrdp/xrdp_cache.c
+++ b/xrdp/xrdp_cache.c
@@ -73,6 +73,11 @@ xrdp_cache_delete(struct xrdp_cache* self)
g_free(self->char_items[i][j].font_item.data);
}
}
+ for (i = 0; i < 2000; i++)
+ {
+ xrdp_bitmap_delete(self->os_bitmap_items[i].bitmap);
+ }
+
g_free(self);
}
@@ -532,3 +537,78 @@ xrdp_cache_add_brush(struct xrdp_cache* self,
DEBUG(("adding brush at %d", index));
return index;
}
+
+/*****************************************************************************/
+/* returns index */
+int APP_CC
+xrdp_cache_add_os_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap,
+ int id)
+{
+ int index;
+ struct xrdp_os_bitmap_item* bi;
+
+ if (id < 1)
+ {
+ return -1;
+ }
+ index = 0;
+ for (index = 0; index < 2000; index++)
+ {
+ bi = self->os_bitmap_items + index;
+ if (bi->bitmap == 0)
+ {
+ bi->id = id;
+ bi->bitmap = bitmap;
+ //g_writeln("xrdp_cache_add_os_bitmap: bitmap id 0x%x added at index %d", id, index);
+ return index;
+ }
+ }
+ g_writeln("xrdp_cache_add_os_bitmap: bitmap id 0x%x not added, full", id);
+ return -1;
+}
+
+/*****************************************************************************/
+/* returns index */
+int APP_CC
+xrdp_cache_remove_os_bitmap(struct xrdp_cache* self, int id)
+{
+ int index;
+ struct xrdp_os_bitmap_item* bi;
+
+ if (id < 1)
+ {
+ return -1;
+ }
+ for (index = 0; index < 2000; index++)
+ {
+ bi = self->os_bitmap_items + index;
+ if (bi->id == id)
+ {
+ xrdp_bitmap_delete(bi->bitmap);
+ g_memset(bi, 0, sizeof(struct xrdp_os_bitmap_item));
+ //g_writeln("xrdp_cache_remove_os_bitmap: bitmap id 0x%x removed from index %d", id, index);
+ return index;
+ }
+ }
+ return -1;
+}
+
+/*****************************************************************************/
+struct xrdp_os_bitmap_item* APP_CC
+xrdp_cache_get_os_bitmap(struct xrdp_cache* self, int id)
+{
+ int index;
+ struct xrdp_os_bitmap_item* bi;
+
+ for (index = 0; index < 2000; index++)
+ {
+ bi = self->os_bitmap_items + index;
+ if (bi->id == id)
+ {
+ //g_writeln("xrdp_cache_get_os_bitmap: bitmap id 0x%x found at index %d", id, index);
+ return bi;
+ }
+ }
+ g_writeln("xrdp_cache_get_os_bitmap: bitmap id 0x%x not found", id);
+ return 0;
+}
diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h
index 79ca7acb..3c5decf6 100644
--- a/xrdp/xrdp_types.h
+++ b/xrdp/xrdp_types.h
@@ -117,6 +117,12 @@ struct xrdp_bitmap_item
struct xrdp_bitmap* bitmap;
};
+struct xrdp_os_bitmap_item
+{
+ int id;
+ struct xrdp_bitmap* bitmap;
+};
+
struct xrdp_char_item
{
int stamp;
@@ -169,6 +175,7 @@ struct xrdp_cache
int pointer_cache_entries;
int brush_stamp;
struct xrdp_brush_item brush_items[64];
+ struct xrdp_os_bitmap_item os_bitmap_items[2000];
};
struct xrdp_mm