Sign in to follow this  

C#, Flash as bitmap is working but performance tips?

Recommended Posts

Hello, I got flash working onto a bitmap, but the performance of it is very slow. I got an fps of 6 frames per second but I like to get a performance of 30. Anyone got any tips. Ohh i got flash on a bitmap using oledraw and bitblt using C#. If anyone needs the code pm me. Greetz, Johan Reitsma

Share this post

Link to post
Share on other sites
Without a lot more detail, I'd say you're stuck with micro-optimization. That process sounds a bit performance-horrific ... mixing GDI and D3D is often a little painful in this respect [smile]

Things to check:

1. can you store/cache handles to resources?
- Is each oledraw/bitblt creating/re-creating GDI resources?

2. are you loading the entire file yourself, or is something else doing it?
- Is it doing anymore work than it has to?

3. At your end - are you handling/writing your resources as efficiently as possible?
- could you manually optimize/overwrite the bitblt/DC conversion?
- do the formats match up? converting pixel formats is expensive.

On the original mention of detail... have you got a profiler? if not, why not? [smile]

When doing performance tuning on something like this you need to know exactly where you're burning CPU time. Otherwise you're fumbling round in the dark hoping to get a lucky break by changing the right thing [lol]


Share this post

Link to post
Share on other sites
The following processes are taking to much time

IntPtr hdc = graphics.GetHdc();
OleDraw(ibrowser.GetOcx(), 1, hdc, ref Rect);

the time taken for this processes are to much and so i get a low fps. How bigger the rectange (Rect) how more time it takes. Taking smaller samples doesn't help neither.

ibrowser is in this case a AxSHDocVw.AxWebBrowser();

This is completly done in C#.

Share this post

Link to post
Share on other sites
At the risk of sounding rather ignorant, is it necessary to "GetHDC" and "release" it everytime you do a oledraw? What if you do a GetHDC once during initialisation and cache it, releasing it only when you are done with everything? Similarly for "GetOCX", do you need to do this everytime you do a oledraw? Again, caching *may* help...

Oh wait, I think that's precisely what jolly is referring to in his first point. Clever chap. :D

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this