Hello
Now FastIndex capability is pushed, I turned my efforts to the FastGlyph (see
attached patch).
However I don't know what to do with the case where the doc says: "glyph data
MUST be retrieved". I think someone with more experience than me could give
some help with that.
Thanks for the attention,
Eduardo Fiss Beloni
bel...@ossystems.com.br
55 53 8117 8244
From 08bf486ebeb43a8424f5e652d5feaacc04f7cf22 Mon Sep 17 00:00:00 2001
From: Eduardo Beloni <bel...@ossystems.com.br>
Date: Thu, 3 Feb 2011 17:23:37 -0200
Subject: [PATCH] xfreerdp: implements FastGlyph
---
libfreerdp/capabilities.c | 2 +-
libfreerdp/orders.c | 170 +++++++++++++++++++++++++++++++++++++++++++++
libfreerdp/orderstypes.h | 23 ++++++
3 files changed, 194 insertions(+), 1 deletions(-)
diff --git a/libfreerdp/capabilities.c b/libfreerdp/capabilities.c
index 2d45cbb..328dfa0 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 b73637a..485cab1 100644
--- a/libfreerdp/orders.c
+++ b/libfreerdp/orders.c
@@ -1206,6 +1206,171 @@ process_fast_index(rdpOrders * orders, STREAM s, FAST_INDEX_ORDER * os, uint32 p
&os->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)
+{
+ int x;
+ int y;
+ int clipx1;
+ int clipy1;
+ int clipx2;
+ int clipy2;
+ int boxx1;
+ int boxy1;
+ int boxx2;
+ int boxy2;
+
+ 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->length);
+
+ x = os->x == -32768 ? os->clipleft : os->x;
+ y = os->y == -32768 ? os->cliptop : os->y;
+ clipx1 = os->clipleft;
+ clipy1 = os->cliptop;
+ clipx2 = os->clipright;
+ clipy2 = os->clipbottom;
+ boxx1 = os->boxleft;
+ boxy1 = os->boxtop;
+ boxx2 = os->boxright;
+ boxy2 = os->boxbottom;
+ if (os->boxleft == 0)
+ {
+ boxx1 = clipx1;
+ }
+ if (os->boxright == 0)
+ {
+ boxx2 = clipx2;
+ }
+ if (os->boxbottom == -32768)
+ {
+ if (os->boxtop & 0x01)
+ {
+ boxy2 = clipy2;
+ }
+ if (os->boxtop & 0x02)
+ {
+ boxx2 = clipx2;
+ }
+ if (os->boxtop & 0x04)
+ {
+ boxy1 = clipy1;
+ }
+ if (os->boxtop & 0x08)
+ {
+ boxx1 = clipx1;
+ }
+ }
+ if ((boxx2 > boxx1) && (boxy2 > boxy1))
+ {
+ }
+ else
+ {
+ boxx1 = 0;
+ boxy1 = 0;
+ boxx2 = 0;
+ boxy2 = 0;
+ }
+
+ printf("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", x, 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->length);
+
+ if (os->length == 1) /* 1-byte glyph cache index from which the glyph data MUST be retrieved */
+ {
+ int idx;
+ FONTGLYPH *glyph;
+/* RD_HBITMAP glyph;*/
+ DATABLOB *text;
+
+ in_uint8(s, idx); /* read only a bytes */
+
+ glyph = cache_get_font(orders->rdp->cache, os->font, idx);
+/* glyph = cache_get_bitmap(orders->rdp->cache, os->font, idx);*/
+ text = cache_get_text(orders->rdp->cache, os->font);
+ do_glyph(orders, (uint8 *) text->data, &idx, &x, &y, os->flags, os->font);
+
+/* 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->length > 1) /* this field contains a Cache Glyph Data - Revision 2 (section 2.2.2.2.1.2.6.1) structure */
+ {
+ int index = 0;
+ uint16 offset, baseline; // x, y
+ uint16 width, height;
+ uint16 size;
+ uint8 character;
+ uint8 *data;
+ uint16 pad;
+ RD_HGLYPH bitmap;
+
+ in_uint8(s, character);
+ offset = parse_delta(s->p, &index);
+ baseline = parse_delta(s->p, &index);
+ width = parse_delta(s->p, &index);
+ height = parse_delta(s->p, &index);
+ s->p += index;
+
+ size = (height * ((width + 7) / 8) + 3) & ~3;
+ data = (uint8 *) xmalloc(size);
+ printf("char=0x%x x=%d y=%d cx=%d cy=%d 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)
@@ -1740,6 +1905,7 @@ process_orders(rdpOrders * orders, STREAM s, uint16 num_orders)
case RDP_ORDER_POLYGON_CB:
case RDP_ORDER_FAST_INDEX:
case RDP_ORDER_ELLIPSE_CB:
+ case RDP_ORDER_FAST_GLYPH:
size = 2;
break;
@@ -1825,6 +1991,10 @@ process_orders(rdpOrders * orders, STREAM s, uint16 num_orders)
process_fast_index(orders, s, &os->fast_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 fe00ce3..86eedf8 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
@@ -323,6 +324,27 @@ typedef struct _FAST_INDEX_ORDER
}
FAST_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 length;
+}
+FAST_GLYPH_ORDER;
+
typedef struct _RDP_ORDER_STATE
{
uint8 order_type;
@@ -343,6 +365,7 @@ typedef struct _RDP_ORDER_STATE
ELLIPSE_CB_ORDER ellipse_cb;
GLYPH_INDEX_ORDER glyph_index;
FAST_INDEX_ORDER fast_index;
+ FAST_GLYPH_ORDER fast_glyph;
}
RDP_ORDER_STATE;
--
1.6.6.1
------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Freerdp-devel mailing list
Freerdp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel