Hello,
This patch is an attempt to implement the capability MultiOpaqueRect. It is
basically used for drawing several rectangles encoded in one single order.
It's not working yet. I couldn't decifrate Delta-Encoded Rectangles from
[MS-RDPEGDI]. There are a few commented lines in the patch, which were my tries
on possible interpretation errors of the capability spec. If some one could
take a look and give some help...
Thank you
Eduardo Fiss Beloni
[email protected]
55 53 8117 8244
From 4a2b31d2be89d50250eef2e6e703f0de07904fa7 Mon Sep 17 00:00:00 2001
From: Eduardo Beloni <[email protected]>
Date: Thu, 10 Feb 2011 10:14:43 -0200
Subject: [PATCH] libfreerdp: add MultiOpaqueRect capability
---
libfreerdp/capabilities.c | 2 +-
libfreerdp/orders.c | 115 +++++++++++++++++++++++++++++++++++++++++++++
libfreerdp/orderstypes.h | 14 ++++++
3 files changed, 130 insertions(+), 1 deletions(-)
diff --git a/libfreerdp/capabilities.c b/libfreerdp/capabilities.c
index a43c5da..881477b 100644
--- a/libfreerdp/capabilities.c
+++ b/libfreerdp/capabilities.c
@@ -190,7 +190,7 @@ rdp_out_order_capset(rdpRdp * rdp, STREAM s)
// orderSupport[NEG_MULTIDSTBLT_INDEX] = 1;
orderSupport[NEG_MULTIPATBLT_INDEX] = 1;
// orderSupport[NEG_MULTISCRBLT_INDEX] = 1;
- // orderSupport[NEG_MULTIOPAQUERECT_INDEX] = 1;
+ orderSupport[NEG_MULTIOPAQUERECT_INDEX] = 1;
orderSupport[NEG_FAST_INDEX_INDEX] = 1;
orderSupport[NEG_POLYGON_SC_INDEX] = (rdp->settings->polygon_ellipse_orders ? 1 : 0);
orderSupport[NEG_POLYGON_CB_INDEX] = (rdp->settings->polygon_ellipse_orders ? 1 : 0);
diff --git a/libfreerdp/orders.c b/libfreerdp/orders.c
index 80776a8..72583c6 100644
--- a/libfreerdp/orders.c
+++ b/libfreerdp/orders.c
@@ -503,6 +503,116 @@ process_opaquerect(rdpOrders * orders, STREAM s, OPAQUERECT_ORDER * os, uint32 p
ui_rect(orders->rdp->inst, os->x, os->y, os->cx, os->cy, os->color);
}
+/* Process a multi opaque rectangle order */
+static void
+process_multiopaquerect(rdpOrders * orders, STREAM s, MULTIOPAQUERECT_ORDER * os, uint32 present, RD_BOOL delta)
+{
+ uint32 i;
+ int size;
+ int index, data, next;
+ int x, y, w = 0, h = 0;
+ uint8 flags = 0;
+ RECTANGLE *rects;
+
+ if (present & 0x001)
+ rdp_in_coord(s, &os->x, delta);
+
+ if (present & 0x002)
+ rdp_in_coord(s, &os->y, delta);
+
+ if (present & 0x004)
+ rdp_in_coord(s, &os->cx, delta);
+
+ if (present & 0x008)
+ rdp_in_coord(s, &os->cy, delta);
+
+ if (present & 0x010)
+ {
+ in_uint8(s, i);
+ os->color = (os->color & 0xffffff00) | i;
+ }
+
+ if (present & 0x020)
+ {
+ in_uint8(s, i);
+ os->color = (os->color & 0xffff00ff) | (i << 8);
+ }
+
+ if (present & 0x040)
+ {
+ in_uint8(s, i);
+ os->color = (os->color & 0xff00ffff) | (i << 16);
+ }
+
+ if (present & 0x080)
+ in_uint8(s, os->nentries);
+
+ if (present & 0x100)
+ {
+ in_uint16_le(s, os->datasize);
+ in_uint8a(s, os->data, os->datasize);
+ }
+
+ printf("MULTIOPAQUERECT(x=%d,y=%d,cx=%d,cy=%d,fg=0x%x,ne=%d,n=%d)\n", os->x, os->y, os->cx, os->cy,
+ os->color, os->nentries, os->datasize);
+
+ size = (os->nentries + 1) * sizeof(RECTANGLE);
+ if (size > orders->buffer_size)
+ {
+ orders->buffer = xrealloc(orders->buffer, size);
+ orders->buffer_size = size;
+ }
+
+ rects = (RECTANGLE *) orders->buffer;
+ memset(rects, 0, size);
+
+/* rects[0].l = os->x;*/
+/* rects[0].t = os->y;*/
+
+ index = 0;
+ data = ((os->nentries - 1) / 8) + 1;
+ for (next = 1; (next <= os->nentries) && (next <= 45) && (data < os->datasize); next++)
+ {
+ if ((next - 1) % 8 == 0)
+ flags = os->data[index++];
+
+ if (~flags & 0x80)
+ rects[next].l = parse_delta(os->data, &data);
+/* else*/
+/* rects[next].l = rects[next - 1].l;*/
+
+ if (~flags & 0x40)
+ rects[next].t = parse_delta(os->data, &data);
+/* else*/
+/* rects[next].t = rects[next - 1].t;*/
+
+ if (~flags & 0x20)
+ rects[next].r = parse_delta(os->data, &data);
+/* else*/
+/* rects[next].r = rects[next - 1].r;*/
+
+ if (~flags & 0x10)
+ rects[next].b = parse_delta(os->data, &data);
+/* else*/
+/* rects[next].b = rects[next - 1].b;*/
+
+ printf("read (%d, %d, %d, %d)\n", rects[next].l, rects[next].t, rects[next].r, rects[next].b);
+
+ printf("flags %x\n", flags);
+ x = abs(abs(rects[next].l) - abs(rects[next - 1].l));
+ y = abs(abs(rects[next].t) - abs(rects[next - 1].t));
+ w = abs(abs(rects[next].r) - abs(rects[next].l));
+ h = abs(abs(rects[next].b) - abs(rects[next].t));
+
+ printf("rect (%d, %d, %d, %d)\n", x, y, w, h);
+ printf("-------------------------------------------------\n");
+
+ flags <<= 4;
+
+ ui_rect(orders->rdp->inst, x, y, w, h, os->color);
+ }
+}
+
/* Process a save bitmap order */
static void
process_savebitmap(rdpOrders * orders, STREAM s, SAVEBITMAP_ORDER * os, uint32 present, RD_BOOL delta)
@@ -2019,6 +2129,7 @@ process_orders(rdpOrders * orders, STREAM s, uint16 num_orders)
case RDP_ORDER_FAST_INDEX:
case RDP_ORDER_ELLIPSE_CB:
case RDP_ORDER_FAST_GLYPH:
+ case RDP_ORDER_MULTIOPAQUERECT:
size = 2;
break;
@@ -2068,6 +2179,10 @@ process_orders(rdpOrders * orders, STREAM s, uint16 num_orders)
process_opaquerect(orders, s, &os->opaquerect, present, delta);
break;
+ case RDP_ORDER_MULTIOPAQUERECT:
+ process_multiopaquerect(orders, s, &os->multiopaquerect, present, delta);
+ break;
+
case RDP_ORDER_SAVEBITMAP:
process_savebitmap(orders, s, &os->savebitmap, present, delta);
break;
diff --git a/libfreerdp/orderstypes.h b/libfreerdp/orderstypes.h
index 5a82d54..96b8d34 100644
--- a/libfreerdp/orderstypes.h
+++ b/libfreerdp/orderstypes.h
@@ -171,6 +171,19 @@ typedef struct _OPAQUERECT_ORDER
}
OPAQUERECT_ORDER;
+typedef struct _MULTIOPAQUERECT_ORDER
+{
+ sint16 x;
+ sint16 y;
+ sint16 cx;
+ sint16 cy;
+ uint32 color;
+ uint8 nentries;
+ uint16 datasize;
+ uint8 data[MAX_DATA];
+}
+MULTIOPAQUERECT_ORDER;
+
typedef struct _SAVEBITMAP_ORDER
{
uint32 offset;
@@ -373,6 +386,7 @@ typedef struct _RDP_ORDER_STATE
SCRBLT_ORDER scrblt;
LINETO_ORDER lineto;
OPAQUERECT_ORDER opaquerect;
+ MULTIOPAQUERECT_ORDER multiopaquerect;
SAVEBITMAP_ORDER savebitmap;
MEMBLT_ORDER memblt;
MEM3BLT_ORDER mem3blt;
--
1.6.6.1
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Freerdp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freerdp-devel