started work on off screen bitmap support

ulab-original
Jay Sorg 12 years ago
parent e8d2e4b6ad
commit 76e070e4f1

@ -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

@ -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;
}

@ -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

@ -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;
}

@ -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

Loading…
Cancel
Save