CDirectScreenAccess Class Reference

#include <w32std.h>

Link against: ws32.lib

class CDirectScreenAccess : public CActive, public CActive

Inherits from

Detailed Description

An active object used to start direct screen access.

Direct screen access is a way of drawing to the screen without using the window server. As this avoids client-server communication, it is much faster, and may be useful for games and video. Note that some interaction with the window server is needed in order to prevent the application from drawing over other application's data.

The object's (private) RunL() function is called by the window server in order to abort direct screen access. This might occur when another window needs to be displayed in front or when the window with direct screen access is moved. The active object's priority is RDirectScreenAccess::EPriorityVeryHigh so that direct screen access will be aborted as quickly as possible.

Constructor & Destructor Documentation

~CDirectScreenAccess ( )

~CDirectScreenAccess()

Member Function Documentation

DrawingRegion ( )

RRegion *DrawingRegion()[inline]

Gets the clipping region to draw to.

You must not draw outside of this region.

The clipping region is calculated when StartL() is called, and is only updated if StartL() is called again.

The region is specified in screen coordinates. This can be useful if you need to reapply the clipping region to the graphics context (CFbsBitGc::SetClippingRegion()).

Return Value
The clipping region to draw to.

Gc ( )

CFbsBitGc *Gc()[inline]

Gets the graphics context for drawing to the screen.

This is set up by calling StartL(). Its origin is set so that you should use window coordinates to specify which part of the screen to draw to and its clipping region is set to the visible part of the window.

Code built to run on the Emulator must call CFbsScreenDevice::Update() in order to see the results of drawing to this graphics context, but this may not be required on all target hardware.

Return Value
The graphics context for drawing to the screen.

NewL ( RWsSession &, CWsScreenDevice &, RWindowBase &, MDirectScreenAccess & )

IMPORT_C CDirectScreenAccess *NewL(RWsSession &aWs,
CWsScreenDevice &aScreenDevice,
RWindowBase &aWin,
MDirectScreenAccess &aAbort
)[static]

Allocates and constructs the object and adds it to the current active scheduler.

This function always causes a flush of the window server buffer.

Parameters
aWsA session with the window server.
aScreenDeviceSpecifies the characteristics of the screen device to draw to.
aWinThe window to draw to directly.
aAbortDefines an AbortNow() and a Restart() function which are both called on aborting, as part of the RunL(). Restart() is called from an idle time active object (CIdle).
Return Value
The newly constructed object.

NewL ( RWsSession &, CWsScreenDevice &, RWindowBase &, MDirectScreenAccess &, TBool )

IMPORT_C CDirectScreenAccess *NewL(RWsSession &aWs,
CWsScreenDevice &aScreenDevice,
RWindowBase &aWin,
MDirectScreenAccess &aAbort,
TBoolaRegionTrackingOnly
)[static]

Allocates and constructs the object and adds it to the current active scheduler.

This function always causes a flush of the window server buffer.

Parameters
aWsA session with the window server.
aScreenDeviceSpecifies the characteristics of the screen device to draw to.
aWinThe window to draw to directly.
aAbortDefines an AbortNow() and a Restart() function which are both called on aborting, as part of the RunL(). Restart() is called from an idle time active object (CIdle).
aRegionTrackingOnlyThe screen device and GC are allocated if this is EFalse, but not if it is ETrue. Only the DSA region data and updates to that are available in the latter case. Creating the screen device will trigger the dsa buffer allocationand it is an operation that could fail, should this happen the function will leave.
Return Value
The newly constructed object.

ScreenDevice ( )

CFbsScreenDevice *&ScreenDevice()[inline]

Gets the screen device to draw to.

You should not use this screen device to create fonts because the object is deleted and recreated when direct screen access is aborted and restarted. Instead, create and use your own CFbsScreenDevice object to create fonts.

Return Value
The target screen device.

StartL ( )

IMPORT_C voidStartL()

Informs the window server that you are going to start direct screen access and sets up a graphics context with which you can draw to the screen.

It should also be called to restart direct screen access after Cancel() has been called to stop it.

While the DSA is in operation, it is strongly advised that the client should not make any call to WSERV that will affect the visible area of the window in which the DSA is taking place.

When WSERV tells the client that it needs to abort its DSA, it waits to receive the acknowledgment from the client that it has done so. However, it doesn't wait for ever, since the client may have entered some long running calculation or even an infinite loop. So WSERV also waits on a timer: if the timer expires before the client acknowledges, then WSERV continues; if, later on, WSERV gets notification from the client that it has aborted the DSA, then WSERV will invalidate the region in which the DSA was taking place, just in case there had been a conflict between the DSA and another client.

This function always causes a flush of the window server buffer.