drawing speed

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

I have a grid control which is completely owner drawn, each cell draw its
background and content, the grid display column separator. and all screen is
filled with GDI drawn content. and each cell set the clipping rect before
drawing.

this gris is not fast enough (particularly during scroll operation).
I already use back buffer and BitBlt.

I wonder if anyone could gives me advice on how to use GDI for speed ?
what is better and what is worst ?
I have to improve the performance ...
 
I am not sure there is much more you can do but here are some general tips
on optimizing GDI. I think you are doing these already:

- Only create one graphics object (or use from OnPaint) when possible (cache
it).
- Do all draws to an off-screen bitmap and then draw the bitmap to the
display all at once.
- Only redraw parts of the image that have changed.
- Blt the same desitnation and source sizes (do not stretch, etc.).

I will post again if I think of anything else - short of writing your own
graphics API with gapi.

--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility

This posting is provided "AS IS" with no warranties, and confers no rights.
 
yep, I do.
I think (just subjective, no measurement) that the drawing might be a bit
faster if I draw the background all at once, instead of doing it per cell...
mmhh. should be sure because it would change a lot...

as for GAPI, I though about it but... is it compatible with WindowsForm ?
I mean could I:
- get the graphic device of one control ? (to draw on that control)
(or one bitmap ? I have a bitmap back buffer)
- could I draw string ? I see no such function with GAPI.

anyway if I could use GAPI on my backbuffer bitmap and drawstring on it and
be faster with it, that would be EXTREMELY GREAT !!!!
 
Hi Lloyd,

I don't think GAPI is really an option for you because, in terms of
graphics, it literally only gives you a pointer to display memory. This
means you have to implement your own API for everything from loading and
drawing bitmaps to raster draws. It is really only for hardcore graphics
applications like games - maybe yours falls into this category. You would
be hard-pressed to implement the wide range of functionality that you get
from the Image and Font classes especially. I have not done any profiling
yet, though I plan to soon, however I do believe it could be significantly
faster than GDI+. I also believe that you are correct about doing your draw
calls all at once instead of by cell, however I would do a small test
profiling this before taking on such a major re-organization.

--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top