MSgDriverAdapter Class Reference

class MSgDriverAdapter

This interface must be implemented by the Graphics Resource Adapter singleton. There must be a single instance of the adaptation layer class that implements this interface in each process using the Graphics Resource API.

Member Functions Documentation

AllocMarkEnd(TInt)

void AllocMarkEnd ( TInt aCount ) [pure virtual]

Test

Marks the end of cell checking at the current nesting level on the heap for adapter objects. Each call to this function must match an earlier call to AllocMarkStart() .

This function checks that the number of cells allocated in the heap for adapter objects, at the current nesting level, is aCount. If the check fails then an SGALLOC:nnnnnnnn panic is raised, where nnnnnnnn is the hexadecimal address of the first orphaned cell.

RAllocator::__DbgMarkEnd()

Parameters

TInt aCount The number of allocated heap cells expected.

AllocMarkStart()

void AllocMarkStart ( ) [pure virtual]

Test

Marks the start of cell checking on the heap for adapter objects. Calls to this function can be nested but each call must be matched by a corresponding call to AllocMarkEnd() .

RAllocator::__DbgMarkStart()

CheckDrawable(const MSgResourceAdapter &)

TBool CheckDrawable ( const MSgResourceAdapter & aDrawable ) const [pure virtual]

Tests whether aDrawable references an existing adapter object representing a drawable resource. This function is called in debug builds to detect invalid RSgDrawable handles.

Parameters

const MSgResourceAdapter & aDrawable

CheckImage(const MSgResourceAdapter &)

TBool CheckImage ( const MSgResourceAdapter & aImage ) const [pure virtual]

Tests whether aImage references an existing adapter object representing an image. This function is called in debug builds to detect invalid RSgImage handles.

Parameters

const MSgResourceAdapter & aImage

CheckImageCollection(const MSgResourceAdapter &)

TBool CheckImageCollection ( const MSgResourceAdapter & aImageCollection ) const [pure virtual]

Tests whether aImageCollection references an existing adapter object representing an image collection. This function is called in debug builds to detect invalid RSgImageCollection handles.

Parameters

const MSgResourceAdapter & aImageCollection

CreateImage(const TSgImageInfo &, const TAny *, TInt, MSgDrawableAdapter *&)

TInt CreateImage ( const TSgImageInfo & aInfo,
const TAny * aDataAddress,
TInt aDataStride,
MSgDrawableAdapter *& aResult
) [pure virtual]

Creates an image with the specified attributes and, optionally, the specified initial contents.

Pre-condition
aInfo is supported.
aResult is null.
Post-condition
aResult points to an adapter object that represents a newly created image with the specified attributes and initial contents. The initial reference count for the image is one.
RSgImage::Create()

Parameters

const TSgImageInfo & aInfo The attributes of the image to be created.
const TAny * aDataAddress The base address of the pixel data used to populate the new image. If this value is null, the initial contents of the image are undefined. If aInfo specifies that the new image is constant, this value must not be null.
TInt aDataStride The number of bytes between rows of the pixel data used to populate the new image.
MSgDrawableAdapter *& aResult On return, a pointer to the adapter object that represents the new image.

CreateImage(const TSgImageInfo &, MSgImageAdapter *, MSgDrawableAdapter *&)

TInt CreateImage ( const TSgImageInfo & aInfo,
MSgImageAdapter * aImage,
MSgDrawableAdapter *& aResult
) [pure virtual]

Creates an image with the specified attributes and initial contents copied from an existing image.

Pre-condition
aInfo is supported.
aImage is not null.
The size and the pixel format specified in aInfo must be the same as the size and the pixel format of the image represented by aImage.
aResult is null.
Post-condition
aResult points to an adapter object that represents a newly created image with the specified attributes and initial contents. The initial reference count for the image is one.
RSgImage::Create()

Parameters

const TSgImageInfo & aInfo The attributes of the image to be created.
MSgImageAdapter * aImage A pointer to the adapter object that represents the existing image to be copied.
MSgDrawableAdapter *& aResult On return, a pointer to the adapter object that represents the new image.

CreateImageCollection(const TSgImageInfo &, TInt, MSgImageCollectionAdapter *&)

TInt CreateImageCollection ( const TSgImageInfo & aInfo,
TInt aImageCount,
MSgImageCollectionAdapter *& aResult
) [pure virtual]

Creates an image collection with the specified attributes.

Pre-condition
aInfo is supported and specifies mutable images.
aImageCount is greater than zero.
aResult is null.
Post-condition
aResult points to an adapter object that represents a newly created image collection with the specified attributes. The initial reference count for the image collection is one.
RSgImageCollection::Create()

Parameters

const TSgImageInfo & aInfo The image attributes of the collection to be created.
TInt aImageCount The number of images in the collection to be created.
MSgImageCollectionAdapter *& aResult On return, a pointer to the adapter object that represents the new image collection.

CreateImageCollections(const TSgImageInfo, TInt, MSgImageCollectionAdapter *, TInt)

TInt CreateImageCollections ( const TSgImageInfo aInfos,
TInt aImageCount,
MSgImageCollectionAdapter * aCollections,
TInt aCollectionCount
) [pure virtual]

Creates a set of image collections that share a single memory chunk.

Pre-condition
All the elements of aInfos are supported and specify mutable images.
aImageCount is greater than zero.
All the pointers in aCollections are null.
aCollectionCount is greater than zero.
Post-condition
The elements of aCollections point to aCollectionCount adapter objects that represent newly created image collections with the specified attributes. The initial reference count for each of the image collections is one.
RSgImageCollection::Create()

Parameters

const TSgImageInfo aInfos An array of aCollectionCount elements with the image attributes of each of the collections to be created.
TInt aImageCount The number of images in each of the collections to be created.
MSgImageCollectionAdapter * aCollections On return, an array of pointers to the adapter objects that represent the new image collections.
TInt aCollectionCount The number of image collections to be created.

Delete()

void Delete ( ) [pure virtual]

Deletes an instance of the singleton class and carries out the termination tasks needed to release the internal resources allocated for the calling process.

SgDriver::Close()

GetPixelFormats(const TSgImageInfo &, TUidPixelFormat *, TInt &)

TInt GetPixelFormats ( const TSgImageInfo & aInfo,
TUidPixelFormat * aPixelFormats,
TInt & aCount
) [pure virtual]

Retrieves the list of image pixel formats supported on this device for a specified usage.

Pre-condition
aInfo is valid.
If aPixelFormats is not null then aCount is greater than zero.
RSgImage::GetPixelFormats()

Parameters

const TSgImageInfo & aInfo The image attributes. aInfo.iPixelFormat is ignored.
TUidPixelFormat * aPixelFormats A pointer to an array that on return will contain the supported pixel formats. If this parameter is null, then this function will just return the number of supported pixel formats in aCount.
TInt & aCount On input, the number of elements in the array pointed to by aPixelFormats if not null, ignored otherwise. On return, the actual number of supported pixel formats. If this number is greater than the number of elements in the array, then the array will be filled with as many pixel formats as it can hold and the function will return KErrOverflow.

New(MSgDriverAdapter *&)

IMPORT_C TInt New ( MSgDriverAdapter *& aPtr ) [static]

Creates a new instance of the singleton class and carries out the initialisation tasks needed to use the Graphics Resource API in the context of the calling process. This is the only function that must be exported by the Graphics Resource Adapter DLL, at ordinal 1.

SgDriver::Open()

Parameters

MSgDriverAdapter *& aPtr On return, a pointer to the new instance of the singleton class.

OpenDrawable(const TSgDrawableId &, TUint32, TUid, MSgDrawableAdapter *&)

TInt OpenDrawable ( const TSgDrawableId & aId,
TUint32 aMode,
TUid aHandleType,
MSgDrawableAdapter *& aResult
) [pure virtual]

Opens a new handle to a drawable resource. If there are no handles to the drawable resource open in the calling process then this function creates a new adapter object that represents the drawable resource in the context of the calling process. Otherwise this function just increments the reference count of the existing adapter object that represents the drawable resource in the context of the calling process.

Pre-condition
aId identifies an existing drawable resource.
All of the requested opening options in aMode are supported.
aHandleType specifies an instance of RSgDrawable or any other handle type that is compatible with the actual type of the specified drawable resource.
aResult is null.
Post-condition
aResult points to either a newly created or an existing adapter object that represents the drawable resource specified by its unique identifier. If a new adapter object is created then its initial reference count is one and the reference count for the drawable resource itself is incremented by one. Otherwise only the reference count for the adapter object is incremented by one.
RSgDrawable::Open()

Parameters

const TSgDrawableId & aId The unique identifier of the drawable resource.
TUint32 aMode Flags controlling how the drawable resource is opened. The only value of this parameter which it is mandatory to support is KSgDefaultOpenMode. Extra opening options may be defined by an implementation of the Graphics Resource API and made available through additional functions.
TUid aHandleType The type of the handle which is to store the reference to the specified drawable resource as a globally unique identifier.
MSgDrawableAdapter *& aResult On return, a pointer to the adapter object that represents the specified drawable resource.

ResourceCount()

TInt ResourceCount ( ) const [pure virtual]

Test

Retrieves the number of handles to graphics resources open in the calling process.

SetAllocFail(RAllocator::TAllocFail, TInt)

void SetAllocFail ( RAllocator::TAllocFail aType,
TInt aRate
) [pure virtual]

Test

Sets the type and rate of simulated allocation failure on the heap for adapter objects.

RAllocator::__DbgSetAllocFail()

Parameters

RAllocator::TAllocFail aType The type of allocation failure requested.
TInt aRate The rate of allocation failure requested.