Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Direct screen access with CDirectScreenBitmap

From Wiki
Jump to: navigation, search

Article Metadata
Tested with
Devices(s): Nokia N90, Nokia N70
Created: User:Technical writer 2 (22 Dec 2005)
Last edited: hamishwillee (14 Jun 2012)


Direct screen access with CDirectScreenBitmap


The CDirectScreenBitmap class offers an alternative way of drawing directly to device screen while bypassing the window server.
The previous method of using the frame buffer address received from UserSvr::ScreenInfo() has its problems, especially on S60 devices because they require special tricks in order to get the screen to update itself.  Furthermore, when using this method, it is not possible to synchronize the drawing to screen refresh rate, often resulting in problems like tearing and/or flickering. On S60 3rd Edition, the UserSvr::ScreenInfo() method is considered to be deprecated.
With CDirectScreenBitmap – also known as the Anti-Tearing API – drawing is synchronized to the LCD refresh rate (on devices that support this feature). It also adds support for multi-display devices.
CDirectScreenBitmap (defined in cdsb.h) is designed to be used together with the CDirectScreenAccess and CActive classes.
  // Creates a direct screen bitmap object for the default screen
  // (No. 0) – the only supported screen in current devices
  iDSBitmap = CDirectScreenBitmap::NewL();
  // After a successful call to CDirectScreenAccess::StartL():
  // (NOTE: should check return value for errors)
  iDSBitmap->Create(iRect, CDirectScreenBitmap::EDoubleBuffer);
where iRect is the drawing rectangle used (usually full screen). S60 devices support double-buffered drawing with CDirectScreenBitmap.
Drawing and updating the screen:
  TAcceleratedBitmapInfo bitmapInfo;
  iScreenAddr = bitmapInfo.iAddress;
after this, iScreenAddr (TUint8 pointer) can be passed to drawing methods to render the next frame.  After the frame is complete,
will notify the video driver that the drawing is finished.  EndUpdate() is asynchronous – it will complete once the screen is updated.  iStatus is the TRequestStatus member from CActive.
Freeing resources:
After a RDirectScreenAccess::AbortNow() callback is received from the DSA framework, the direct screen bitmap should also be closed:
when restarting DSA after a RDirectScreenAccess:: Restart()callback, a new call to CDirectScreenBitmap::Create() is needed.

This page was last modified on 14 June 2012, at 06:30.
32 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.