diff -r 48780e181b38 -r 578be2adaf3e Symbian3/PDK/Source/GUID-E6E6A439-B3CC-5FEA-9148-2DB5F37003F2.dita --- a/Symbian3/PDK/Source/GUID-E6E6A439-B3CC-5FEA-9148-2DB5F37003F2.dita Tue Jul 20 12:00:49 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-E6E6A439-B3CC-5FEA-9148-2DB5F37003F2.dita Fri Aug 13 16:47:46 2010 +0100 @@ -23,7 +23,7 @@ EndBitmap()

If the extended bitmap rasterizer DLL has a cache of previously rasterized extended bitmaps, calls to CFbsBitmap::GetScanLine(), CFbsBitmap::GetPixel() and CFbsBitmap::GetVerticalScanLine() do not need to rasterize the bitmap for each call, which can improve performance dramatically.

An extended bitmap rasterizer DLL cache contains the previously rasterized content for the most recently used extended bitmaps. Typically the extended bitmap rasterizer DLL adds new bitmaps to the cache when CFbsRasterizer::BeginBitmap() is called (if they are not already in the cache) and does not automatically remove bitmaps from the cache when CFbsRasterizer::EndBitmap() is called.

It is possible for an extended bitmap to be deleted before its cached information is deleted from the cache. It is therefore important that the cache does not store pointers to the data that was used to create the pre-rasterized content.

There are two approaches that can be used to manage the cache:

It is recommended that you use both mechanisms in order to optimize memory usage. The example extended bitmap rasterizer DLL does this. It maintains a list of recently used bitmaps, with the most recently used one being first in the list. If the size of the cache exceeds the set maximum, the oldest bitmaps are removed until the size is within limits again. The example extended bitmap rasterizer DLL also uses a CIdle object that clears the cache during idle times.

Memory

The example extended bitmap rasterizer DLL allocates and frees memory during CFbsRasterizer::BeginBitmap() and CFbsRasterizer::EndBitmap(), respectively. This approach may be slow if frequent allocation and freeing of large amounts of memory is required.

A possible solution is to pre-allocate a memory pool from which the extended bitmap rasterizer DLL can use areas of memory. This reduces the number of allocations. However, this solution may be unsuitable for some scenarios, such as when memory usage is more important than performance.

Example extended bitmap rasterizer

The Symbian platform provides a simple example extended bitmap rasterizer, which you can use as a reference when you are creating your own. The source code is located in the os\graphics\fbs\fontandbitmapserver\trasterizer\src folder. It is built as fbsrasterizer_test.dll when you build the test code for the Font and Bitmap Server component.

This extended bitmap rasterizer DLL handles a tricolor flag. The data comprises the flag's three colors and the direction (horizontal or vertical) of the stripes as shown in the following picture.

Tricolor flag with horizontal and vertical stripes -
Packaging the DLL

Because an extended bitmap rasterizer DLL is optional, there is a stub implementation for platform security reasons. When a functional extended bitmap rasterizer DLL is not present, the stub implementation is compiled into a DLL and is installed in the ROM in order to prevent a SIS file installing a rogue DLL with the same name.

The MMP file

Here is a snippet from the stub implementation's MMP file:

TARGET fbsrasterizer_stub.dll +
Packaging the DLL

Because an extended bitmap rasterizer DLL is optional, there is a stub implementation for platform security reasons. When a functional extended bitmap rasterizer DLL is not present, the stub implementation is compiled into a DLL and is installed in the ROM in order to prevent a SIS file installing a rogue DLL with the same name.

The MMP file

Here is a snippet from the stub implementation's MMP file:

TARGET fbsrasterizer_stub.dll TARGETTYPE DLL CAPABILITY All -Tcb UID 0x1000008D 0x10285EAE