> > I've made some progress with
> this.
> > Almost working.
> > The documentation is wrong.
>
> This patch should work.
> If you can validate it, I can push it.
It works great! I just think you should use DEBUG instead of printf and replace
the last debug call to right before draw_text.
I've also got a not working patch which adds FastGlyph capability. It may save
you some work if you find it useful. It is attached.
Thanks very much for the help Jay
Eduardo Fiss Beloni
bel...@ossystems.com.br
55 53 8117 8244
From 0cf8a66187bf5344cfcc1dd1f7a260d98b64e866 Mon Sep 17 00:00:00 2001
From: Eduardo Beloni <bel...@ossystems.com.br>
Date: Fri, 28 Jan 2011 10:08:31 -0200
Subject: [PATCH] libfreerdp: implement FastGlyph
---
libfreerdp/capabilities.c | 2 +-
libfreerdp/orders.c | 105 +++++++++++++++++++++++++++++++++++++++++++++
libfreerdp/orderstypes.h | 23 ++++++++++
3 files changed, 129 insertions(+), 1 deletions(-)
diff --git a/libfreerdp/capabilities.c b/libfreerdp/capabilities.c
index 1a8bee8..f7f4f5e 100644
--- a/libfreerdp/capabilities.c
+++ b/libfreerdp/capabilities.c
@@ -195,7 +195,7 @@ rdp_out_order_capset(rdpRdp * rdp, STREAM s)
orderSupport[NEG_POLYGON_SC_INDEX] = (rdp->settings->polygon_ellipse_orders ? 1 : 0);
orderSupport[NEG_POLYGON_CB_INDEX] = (rdp->settings->polygon_ellipse_orders ? 1 : 0);
orderSupport[NEG_POLYLINE_INDEX] = 1;
- // orderSupport[NEG_FAST_GLYPH_INDEX] = 1;
+ orderSupport[NEG_FAST_GLYPH_INDEX] = 1;
// orderSupport[NEG_ELLIPSE_SC_INDEX] = (rdp->settings->polygon_ellipse_orders ? 1 : 0);
// orderSupport[NEG_ELLIPSE_CB_INDEX] = (rdp->settings->polygon_ellipse_orders ? 1 : 0);
orderSupport[NEG_INDEX_INDEX] = 1;
diff --git a/libfreerdp/orders.c b/libfreerdp/orders.c
index 21f9187..171ec3f 100644
--- a/libfreerdp/orders.c
+++ b/libfreerdp/orders.c
@@ -1012,6 +1012,8 @@ draw_text(rdpOrders * orders, uint8 font, uint8 flags, uint8 opcode, int mixmode
static void
process_glyph_index(rdpOrders * orders, STREAM s, GLYPH_INDEX_ORDER * os, uint32 present, RD_BOOL delta)
{
+printf("%s\n", __PRETTY_FUNCTION__);
+hexdump(s->p, 32);
int i;
RD_BRUSH brush;
@@ -1089,6 +1091,104 @@ process_glyph_index(rdpOrders * orders, STREAM s, GLYPH_INDEX_ORDER * os, uint32
&brush, os->bgcolor, os->fgcolor, os->text, os->length);
}
+/* Process a fast glyph order */
+static void
+process_fast_glyph(rdpOrders * orders, STREAM s, FAST_GLYPH_ORDER * os, uint32 present, RD_BOOL delta)
+{
+ if (present & 0x000001)
+ in_uint8(s, os->font);
+
+ if (present & 0x000002)
+ {
+ in_uint8(s, os->opcode);
+ in_uint8(s, os->flags);
+ }
+
+ if (present & 0x000004)
+ rdp_in_color(s, &os->fgcolor);
+
+ if (present & 0x000008)
+ rdp_in_color(s, &os->bgcolor);
+
+ if (present & 0x000010)
+ rdp_in_coord(s, &os->clipleft, delta);
+
+ if (present & 0x000020)
+ rdp_in_coord(s, &os->cliptop, delta);
+
+ if (present & 0x000040)
+ rdp_in_coord(s, &os->clipright, delta);
+
+ if (present & 0x000080)
+ rdp_in_coord(s, &os->clipbottom, delta);
+
+ if (present & 0x000100)
+ rdp_in_coord(s, &os->boxleft, delta);
+
+ if (present & 0x000200)
+ rdp_in_coord(s, &os->boxtop, delta);
+
+ if (present & 0x000400)
+ rdp_in_coord(s, &os->boxright, delta);
+
+ if (present & 0x000800)
+ rdp_in_coord(s, &os->boxbottom, delta);
+
+ if (present & 0x001000)
+ rdp_in_coord(s, &os->x, delta);
+
+ if (present & 0x002000)
+ rdp_in_coord(s, &os->y, delta);
+
+ if (present & 0x004000)
+ in_uint8(s, os->datasize);
+
+ DEBUG("FAST_GLYPH(x=%d,y=%d,cl=%d,ct=%d,cr=%d,cb=%d,bl=%d,bt=%d,br=%d,bb=%d,bg=0x%x,fg=0x%x,font=%d,fl=0x%x,op=0x%x,n=%d)\n", os->x, os->y, os->clipleft, os->cliptop, os->clipright, os->clipbottom, os->boxleft, os->boxtop, os->boxright, os->boxbottom, os->bgcolor, os->fgcolor, os->font, os->flags, os->opcode, os->datasize);
+
+ if (os->datasize == 1) /* 1-byte glyph cache index from which the glyph data MUST be retrieved */
+ {
+ uint8 idx;
+ FONTGLYPH *glyph;
+
+ in_uint8(s, idx);
+
+ glyph = cache_get_font(orders->rdp->cache, os->font, idx);
+ ui_start_draw_glyphs(orders->rdp->inst, os->bgcolor, os->fgcolor);
+ ui_draw_glyph(orders->rdp->inst, glyph->offset, glyph->baseline,
+ glyph->width, glyph->height, glyph->pixmap);
+ ui_end_draw_glyphs(orders->rdp->inst, glyph->offset, glyph->baseline,
+ glyph->width, glyph->height);
+ }
+ else if (os->datasize > 1) /* this field contains a Cache Glyph Data - Revision 2 (section 2.2.2.2.1.2.6.1) structure */
+ {
+ uint16 offset, baseline; // x, y
+ uint16 width, height;
+ uint16 size;
+ uint8 character;
+ uint8 *data;
+ uint16 pad;
+ RD_HGLYPH bitmap;
+
+ in_uint8(s, character);
+ in_uint16_le(s, offset);
+ in_uint16_le(s, baseline);
+ in_uint16_le(s, width);
+ in_uint16_le(s, height);
+
+ size = (height * ((width + 7) / 8) + 3) & ~3;
+ data = (uint8 *) xmalloc(size);
+ printf("char=0x%x x=0x%x y=0x%x cx=0x%x cy=0x%x size=%d\n", character, offset, baseline, width, height, size);
+ in_uint8p(s, data, size);
+ in_uint16_le(s, pad);
+
+ bitmap = ui_create_glyph(orders->rdp->inst, width, height, data);
+ cache_put_font(orders->rdp->cache, os->font, character, offset, baseline, width,
+ height, bitmap);
+
+/* xfree(data);*/
+ }
+}
+
/* Process a raw bitmap cache order */
static void
process_cache_bitmap_uncompressed(rdpOrders * orders, STREAM s)
@@ -1622,6 +1722,7 @@ process_orders(rdpOrders * orders, STREAM s, uint16 num_orders)
case RDP_ORDER_LINETO:
case RDP_ORDER_POLYGON_CB:
case RDP_ORDER_ELLIPSE_CB:
+ case RDP_ORDER_FAST_GLYPH:
size = 2;
break;
@@ -1703,6 +1804,10 @@ process_orders(rdpOrders * orders, STREAM s, uint16 num_orders)
process_glyph_index(orders, s, &os->glyph_index, present, delta);
break;
+ case RDP_ORDER_FAST_GLYPH:
+ process_fast_glyph(orders, s, &os->fast_glyph, present, delta);
+ break;
+
default:
ui_unimpl(orders->rdp->inst, "order %d\n", os->order_type);
return;
diff --git a/libfreerdp/orderstypes.h b/libfreerdp/orderstypes.h
index 52e95ca..5edd5c3 100644
--- a/libfreerdp/orderstypes.h
+++ b/libfreerdp/orderstypes.h
@@ -52,6 +52,7 @@ enum RDP_ORDER_TYPE
RDP_ORDER_POLYGON_SC = 20,
RDP_ORDER_POLYGON_CB = 21,
RDP_ORDER_POLYLINE = 22,
+ RDP_ORDER_FAST_GLYPH = 24,
RDP_ORDER_ELLIPSE_SC = 25,
RDP_ORDER_ELLIPSE_CB = 26,
RDP_ORDER_GLYPH_INDEX = 27
@@ -300,6 +301,27 @@ typedef struct _GLYPH_INDEX_ORDER
}
GLYPH_INDEX_ORDER;
+typedef struct _FAST_GLYPH_ORDER
+{
+ uint8 font;
+ uint8 flags;
+ uint8 opcode;
+ uint32 bgcolor;
+ uint32 fgcolor;
+ sint16 clipleft;
+ sint16 cliptop;
+ sint16 clipright;
+ sint16 clipbottom;
+ sint16 boxleft;
+ sint16 boxtop;
+ sint16 boxright;
+ sint16 boxbottom;
+ sint16 x;
+ sint16 y;
+ uint8 datasize;
+}
+FAST_GLYPH_ORDER;
+
typedef struct _RDP_ORDER_STATE
{
uint8 order_type;
@@ -319,6 +341,7 @@ typedef struct _RDP_ORDER_STATE
ELLIPSE_SC_ORDER ellipse_sc;
ELLIPSE_CB_ORDER ellipse_cb;
GLYPH_INDEX_ORDER glyph_index;
+ FAST_GLYPH_ORDER fast_glyph;
}
RDP_ORDER_STATE;
--
1.6.6.1
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Freerdp-devel mailing list
Freerdp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel