×
Namespaces

Variants
Actions

Direct screen access with CDirectScreenBitmap

From Nokia Developer Wiki
Jump to: navigation, search



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

Overview

Direct screen access with CDirectScreenBitmap

Description

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.
Usage:
CDirectScreenBitmap (defined in cdsb.h) is designed to be used together with the CDirectScreenAccess and CActive classes.
Construction:
  // Creates a direct screen bitmap object for the default screen
  // (No. 0) – the only supported screen in current devices
  iDSBitmap = CDirectScreenBitmap::NewL();
Initialization:
  // 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;
  iDSBitmap->BeginUpdate(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,
  iDSBitmap->EndUpdate(iStatus);
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:
  iDSBitmap->Close();
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 09:30.
54 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.

×