Thank you for the reply Jay.

The attached file is my patch which adds a proper polygon drawing function. If 
no one disagrees I'll push it up.


Eduardo Fiss Beloni
bel...@ossystems.com.br
55 53 8117 8244



--- On Tue, 1/25/11, Jay Sorg <jay.s...@gmail.com> wrote:

> From: Jay Sorg <jay.s...@gmail.com>
> Subject: Re: [Freerdp-devel] Polygon rendering cmd line option
> To: "eduardo fiss beloni" <eduardobel...@yahoo.com.br>
> Cc: freerdp-devel@lists.sourceforge.net
> Date: Tuesday, January 25, 2011, 2:11 PM
> > I've been working in the
> function ui_polygon implementation which, together with this
> diff
> >
> > --- a/libfreerdp/capabilities.c
> > +++ b/libfreerdp/capabilities.c
> >
> > -       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_POLYGON_SC_INDEX] = 1;
> > +       orderSupport[NEG_POLYGON_CB_INDEX] = 1;
> >
> > can make freerdp rendering significantly faster in
> some cases.
> >
> > The problem is: I don't know where should I set
> settings->polygon_ellipse_orders to TRUE (this field is 0
> by default and is not set directly in the code, only through
> a memset). Should it be a command line option? Or it could
> be set hard coded?
> >
> > I'd appreciate any opinions
> 
> The polygon functions were off by default because the
> ui_poly*
> functions were incomplete.
> I don't think they can be hard coded on in capabilities.c
> because some
> ui's don't have much(or no) polygon support.
> I think they can default on in the X11 ui(the main one).
> You can edit X11/xfreerdp.c function set_default_params to
> make them
> on by default in the X11 ui.
> 
> Jay
>


      
commit 7ff382a5df9526497a147e0e76c5b14b4ceeea0d
Author: Eduardo Beloni <bel...@ossystems.com.br>
Date:   Mon Jan 24 18:06:10 2011 -0200

    xfreerdp: implement ui_polygon function
    
    Draw polygons properly

diff --git a/X11/xf_win.c b/X11/xf_win.c
index b3e3d49..b9d1419 100644
--- a/X11/xf_win.c
+++ b/X11/xf_win.c
@@ -362,7 +362,127 @@ static void
 l_ui_polygon(struct rdp_inst * inst, uint8 opcode, uint8 fillmode, RD_POINT * point,
 	int npoints, RD_BRUSH * brush, int bgcolor, int fgcolor)
 {
-	printf("ui_polygon:\n");
+	uint8 style, i, ipattern[8];
+	Pixmap fill;
+	xfInfo * xfi;
+
+	xfi = GET_XFI(inst);
+	xf_set_rop2(xfi, opcode);
+	style = brush ? brush->style : 0;
+
+	fgcolor = xf_color_convert(xfi, inst->settings, fgcolor);
+	bgcolor = xf_color_convert(xfi, inst->settings, bgcolor);
+
+	switch (fillmode)
+	{
+		case 1: /* alternate */
+			XSetFillRule(xfi->display, xfi->gc, EvenOddRule);
+			break;
+		case 2: /* winding */
+			XSetFillRule(xfi->display, xfi->gc, WindingRule);
+			break;
+		default:
+			printf("fill mode %d\n", fillmode);
+	}
+
+	switch (style)
+	{
+		case 0:	/* Solid */
+			XSetForeground(xfi->display, xfi->gc, fgcolor);
+			XFillPolygon(xfi->display, xfi->wnd, xfi->gc,
+				(XPoint *) point, npoints, Complex, CoordModePrevious);
+			if (xfi->drw == xfi->backstore)
+			{
+				XFillPolygon(xfi->display, xfi->backstore, xfi->gc,
+					(XPoint *) point, npoints, Complex, CoordModePrevious);
+			}
+			break;
+
+		case 2:	/* Hatch */
+			fill = (Pixmap) l_ui_create_glyph(inst, 8, 8,
+							g_hatch_patterns + brush->pattern[0] * 8);
+			XSetForeground(xfi->display, xfi->gc, fgcolor);
+			XSetBackground(xfi->display, xfi->gc, bgcolor);
+			XSetFillStyle(xfi->display, xfi->gc, FillOpaqueStippled);
+			XSetStipple(xfi->display, xfi->gc, fill);
+			XSetTSOrigin(xfi->display, xfi->gc, brush->xorigin, brush->yorigin);
+			XFillPolygon(xfi->display, xfi->wnd, xfi->gc,
+				(XPoint *) point, npoints, Complex, CoordModePrevious);
+			if (xfi->drw == xfi->backstore)
+			{
+				XFillPolygon(xfi->display, xfi->backstore, xfi->gc,
+					(XPoint *) point, npoints, Complex, CoordModePrevious);
+			}
+			XSetFillStyle(xfi->display, xfi->gc, FillSolid);
+			XSetTSOrigin(xfi->display, xfi->gc, 0, 0);
+			l_ui_destroy_glyph(inst, (RD_HGLYPH) fill);
+			break;
+
+		case 3:	/* Pattern */
+			if (brush->bd == 0)	/* rdp4 brush */
+			{
+				for (i = 0; i != 8; i++)
+					ipattern[7 - i] = brush->pattern[i];
+				fill = (Pixmap) l_ui_create_glyph(inst, 8, 8, ipattern);
+				XSetForeground(xfi->display, xfi->gc, fgcolor);
+				XSetBackground(xfi->display, xfi->gc, bgcolor);
+				XSetFillStyle(xfi->display, xfi->gc, FillOpaqueStippled);
+				XSetStipple(xfi->display, xfi->gc, fill);
+				XSetTSOrigin(xfi->display, xfi->gc, brush->xorigin, brush->yorigin);
+				XFillPolygon(xfi->display, xfi->wnd, xfi->gc,
+					(XPoint *) point, npoints, Complex, CoordModePrevious);
+				if (xfi->drw == xfi->backstore)
+				{
+					XFillPolygon(xfi->display, xfi->backstore, xfi->gc,
+						(XPoint *) point, npoints, Complex, CoordModePrevious);
+				}
+				XSetFillStyle(xfi->display, xfi->gc, FillSolid);
+				XSetTSOrigin(xfi->display, xfi->gc, 0, 0);
+				l_ui_destroy_glyph(inst, (RD_HGLYPH) fill);
+			}
+			else if (brush->bd->color_code > 1)	/* > 1 bpp */
+			{
+				fill = (Pixmap) l_ui_create_bitmap(inst, 8, 8, brush->bd->data);
+				XSetFillStyle(xfi->display, xfi->gc, FillTiled);
+				XSetTile(xfi->display, xfi->gc, fill);
+				XSetTSOrigin(xfi->display, xfi->gc, brush->xorigin, brush->yorigin);
+				XFillPolygon(xfi->display, xfi->wnd, xfi->gc,
+					(XPoint *) point, npoints, Complex, CoordModePrevious);
+				if (xfi->drw == xfi->backstore)
+				{
+					XFillPolygon(xfi->display, xfi->backstore, xfi->gc,
+						(XPoint *) point, npoints, Complex, CoordModePrevious);
+				}
+				XSetFillStyle(xfi->display, xfi->gc, FillSolid);
+				XSetTSOrigin(xfi->display, xfi->gc, 0, 0);
+				l_ui_destroy_bitmap(inst, (RD_HBITMAP) fill);
+			}
+			else
+			{
+				fill = (Pixmap) l_ui_create_glyph(inst, 8, 8, brush->bd->data);
+				XSetForeground(xfi->display, xfi->gc, fgcolor);
+				XSetBackground(xfi->display, xfi->gc, bgcolor);
+				XSetFillStyle(xfi->display, xfi->gc, FillOpaqueStippled);
+				XSetStipple(xfi->display, xfi->gc, fill);
+				XSetTSOrigin(xfi->display, xfi->gc, brush->xorigin, brush->yorigin);
+				XFillPolygon(xfi->display, xfi->wnd, xfi->gc,
+					(XPoint *) point, npoints, Complex, CoordModePrevious);
+				if (xfi->drw == xfi->backstore)
+				{
+					XFillPolygon(xfi->display, xfi->backstore, xfi->gc,
+						(XPoint *) point, npoints, Complex, CoordModePrevious);
+				}
+				XSetFillStyle(xfi->display, xfi->gc, FillSolid);
+				XSetTSOrigin(xfi->display, xfi->gc, 0, 0);
+				l_ui_destroy_glyph(inst, (RD_HGLYPH) fill);
+			}
+			break;
+
+		default:
+			printf("brush %d\n", brush->style);
+	}
+
+	XSetFunction(xfi->display, xfi->gc, GXcopy);
 }
 
 static void
diff --git a/X11/xfreerdp.c b/X11/xfreerdp.c
index 4ce2a9b..58a6780 100644
--- a/X11/xfreerdp.c
+++ b/X11/xfreerdp.c
@@ -66,6 +66,7 @@ set_default_params(xfInfo * xfi)
 	settings->performanceflags =
 		PERF_DISABLE_WALLPAPER | PERF_DISABLE_FULLWINDOWDRAG | PERF_DISABLE_MENUANIMATIONS;
 	settings->off_screen_bitmaps = 1;
+	settings->polygon_ellipse_orders = 1;
 	settings->triblt = 0;
 	settings->new_cursors = 1;
 	settings->rdp_version = 5;
------------------------------------------------------------------------------
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

Reply via email to