[Mono-winforms-list] MWF painting VERY slow compared to .NET

Davide Morelli davide.morelli at parser.it
Fri Jul 29 06:25:16 EDT 2005


I will SURELY share the code and it will be Open Source because:
- it simply is a modification of libgdiplus (replacing Cairo calls with Core 
Graphics calls)
- I want to share the code

the project is really immature and can't be used in a MWF app because I 
didn't want to replace Cairo for the real Microsoft.Windows.Forms but i only 
needed to draw on a Graphics (my app's interface is native cocoa, I needed 
my application to look exactly like a cocoa app).

You are right: I'm still using System.Drawing
I had to modify System.Drawing because:
- I wanted a Graphics to be created from a CGContextRef, so I wrote a new 
Graphics constructor thant doesn't look for a control window but trusts that 
the passed IntPtr points to a CGContextRef
- I wasn't able to write a Region Constructor from a GraphicsPath, (in the 
original app I was using Regions to test intersections between 
GraphicsPaths) so I wrote a new function: "bool 
GraphicsPath.IntersectsWith(GraphicsPath path)"

There are also "errors":
- Bitmaps code is all wrong, but it works for my needs so I kept as is.

It is not documented at all

As said before you can't use it in a MWF app but you can use it in a Cocoa 
app using mono embedding.

So don't expect too much from it !

I will upload the code I am working on as soon as I can, but I'll leave for 
vacations tomorrow and will be back on the 14th of Aug, so you may have to 
wait a couple of weeks (but I'll try to upload something today)


----- Original Message ----- 
From: "Peter Dennis Bartok" <peter at novonyx.com>
To: "Parser - Davide Morelli" <davide.morelli at parser.it>; 
<mono-winforms-list at lists.ximian.com>
Sent: Friday, July 29, 2005 7:20 AM
Subject: Re: [Mono-winforms-list] MWF painting VERY slow compared to .NET

> That sounds pretty exciting. Any chance you could share the code? I'd like
> to investigate and see how much work it is to use your version it instead 
> of
> our cairo version when running on the Mac. I'm guessing you are still 
> using
> System.Drawing, just having it call your gdiplus lib?
> Would you mind posting a URL to the code?
> Cheers,
>  Peter
> -----Original Message-----
> From: "Parser - Davide Morelli" <davide.morelli at parser.it>
> To: <mono-winforms-list at lists.ximian.com>
> Date: Thursday, 28 July, 2005 18:33
> Subject: R: [Mono-winforms-list] MWF painting VERY slow compared to .NET
> Hello list,
> I wrote a sw in .NET for windows (a sort of graphical editor) and now I 
> need
> to port it to OSX.
> Being Cairo so slow i decided to write an alternative libgdiplus.dylib
> dedicated to OSX using only Core Graphics Calls.
> It won't be complete, I will only implement those methods I used in the
> original .NET sw.
> I am at a good point and it works like a charm.
> I will surely release it under the GPL license (because I took some code
> from the original libgdiplus).
> Using Cocoa i could also implement some feature that was missing in
> libgdiplus ( mostly GraphicsPath.AddString() thanks to NSBezierPath ).
> I am not saying that Cairo should not be used, I only had to avoid it
> because I needed performances and my software must be released soon.
> If you are interested I can share the code.
> Ciao,
> Daivde.
>> -----Messaggio originale-----
>> Da: mono-winforms-list-bounces at lists.ximian.com
>> [mailto:mono-winforms-list-bounces at lists.ximian.com] Per
>> conto di Peter De Jager
>> Inviato: mercoledì 27 luglio 2005 11.34
>> A: mono-winforms-list at lists.ximian.com
>> Oggetto: [Mono-winforms-list] MWF painting VERY slow compared to .NET
>> When painting a bitmap to a Form and measuring the frame
>> rate, I get vastly different figures on .NET vs. Mono. E.g.
>> on .NET I get 114 fps while under mono it's only 4.5 fps (on
>> the same hardware). What's even stranger is that I get the
>> same (4.5 fps) figure on a PowerPC Mac mini (1.42 GHz G4, 167MHz
>> bus) and an Intel box (dual 3GHz Xeon, 533MHz bus). Both
>> systems are running Fedora Core 4. I thought that perhaps it
>> relates to video drivers but I installed the latest ATI
>> driver on my Xeon box (Radeon 9800 Pro) and there is still no
>> difference.
>> Something else is that on WMF, the background is always
>> painted even though I override OnPaintBackground of my Form
>> with an empty implementation, e.g.:
>> protected override void OnPaintBackground(PaintEventArgs e) { }
>> On Windows, this prevents the Form from repainting the
>> background, thus speeding up painting and reducing flicker,
>> while MWF always appears to repaint the background.
>> I've done (very limited) testing on Gtk (Glade), and it
>> appears to be fast on Linux (comparable to
>> System.Windows.Forms on .NET), but while being fast on Linux,
>> Glade is MUCH slower on Windows (I don't have exact figures
>> but it's very noticable).
>> Is the MWF implementation likely to increase in speed (by 20
>> times!) as it matures, or should I use Gtk for Linux / OS X
>> and System.Windows.Forms for Windows? I was hoping that I
>> could use a single code base for all platforms (which has
>> been the case so far).
>> Don't take this the wrong way, I don't mean to be critical. I
>> think it's great that there is a managed implementation of
>> Windows Forms, but at 20 times slower it renders my Windows
>> applications unusable under Mono.
>> Thanks
>> Pete.
>> _______________________________________________
>> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>> --
>> No virus found in this incoming message.
>> Checked by AVG Anti-Virus.
>> Version: 7.0.338 / Virus Database: 267.9.4/57 - Release Date:
>> 22/07/2005
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list

More information about the Mono-winforms-list mailing list