Symbian
Symbian OS Library

FAQ-1218 How can I draw fast onto the screen with the minimum overhead

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Graphics
Created: 02/11/2005 Modified: 02/23/2005
Number: FAQ-1218
Platform: Symbian OS v7.0, Symbian OS v7.0s, Symbian OS v8.0

Question:
Which type of bitmap (CWsBitmap/CFbsBitmap) should one use to draw as many 2D polygons/polylines per second as possible?

Would it be better if I implemented my own drawing methods that draw directly to a memory bitmap to avoid server communication?


Answer:
Q1: Which type of bitmap (CWsBitmap/CFbsBitmap) should one use to draw as many 2D polygons/polylines per second as possible?

If you go for this solution (between CWsBitmap and CFbsBitmap) then out of the two  you  should use the former. Which ever of the two you use, it will be just as quick to draw into them. The first is quicker to draw to the screen via WSERV; but has more overhead in creating it in the first place.


Q2: Would it be better if I implemented my own drawing methods that draw directly to a memory bitmap to avoid server communication?

For drawing directly, you have two options of the way to get it onto the screen. For most purposes drawing should be done via a CWindowGc which goes through WSERV. If you are doing very time sensitive drawing, you might be better off using DSA (Direct Screen Access). DSA of course, still needs executive calls to (a driver in) the kernel. What it saves you is  the context switch between the client->Kernel-> WSERV.

The classes to look at if you want to use DSA are: CDirectScreenAccess, MDirectScreenAccess (and maybe RDirectScreenAccess).


Furthermore, there is a new type of bitmap: "hardware bitmap".  Which you might be able to use instead, they have been around for some time. Beware though, that they only are better for devices that have been set up to make use of acceleration in hardware, ie. by default they would just be one of the first two types of bitmaps mentioned above. So you need to find from device manufacturers whether they offer accelarated use of them in their phones.

The interface to look at in the API is RHardwareBitmap.