sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // CompositionSurfaceUpdate.h sl@0: // Interface to be implemented and registered with SUS by listener for surface content update messages. sl@0: // sl@0: #ifndef __COMPOSITIONSURFACEUPDATE_H__ sl@0: #define __COMPOSITIONSURFACEUPDATE_H__ sl@0: sl@0: /** sl@0: * \brief Interface to implement and register with SUS to receive ContentUpdated() notifications. sl@0: * sl@0: * sl@0: **/ sl@0: NONSHARABLE_CLASS(MCompositionSurfaceUpdate) sl@0: { sl@0: public: sl@0: enum sl@0: { sl@0: KUidCompositionSurfaceUpdate = 0x10286498, sl@0: ETypeId= KUidCompositionSurfaceUpdate sl@0: }; sl@0: /*-------------------------------------------------------------------*//*! sl@0: * \brief Gets the API version number of the sl@0: * implementation. sl@0: * sl@0: * @return 1 for Oghma conformant implementation, sl@0: * 2 for Sphinx (Maybe). sl@0: * 3 for Native Stream first version. sl@0: *//*-------------------------------------------------------------------*/ sl@0: sl@0: virtual TInt ApiVersion (void) = 0; sl@0: sl@0: /*-------------------------------------------------------------------*//*! sl@0: * \brief Gets the internal version number of the sl@0: * implementation. sl@0: * sl@0: * @return The version number of the sl@0: * instance. sl@0: *//*-------------------------------------------------------------------*/ sl@0: sl@0: virtual TVersion InternalVersion (void) = 0; sl@0: sl@0: /*-------------------------------------------------------------------*//*! sl@0: * \brief A function that responds to surface content notifications. sl@0: * sl@0: * When the contents of a surface change, this function gets called sl@0: * by a mechanism that is an implementation detail of the graphics sl@0: * driver together with the Native Stream and Compositor implementations. sl@0: * The call can originate from different processes and the sl@0: * Native Stream together with the Compositor implementation sl@0: * relays the information content of it, through implementation sl@0: * specific means, to trigger the actual composition soon after this sl@0: * call - this composition call should be synchronized with the sl@0: * refresh rate of the screen. sl@0: * sl@0: * @param aSurface The surface that has been updated. sl@0: * @param aBuffer The buffer of the surface to be used in sl@0: * composition. Integer starting from 0. sl@0: * @param aRegion The sub-area that has the updates. If NULL, the sl@0: * whole surface is considered changed. sl@0: * @param aStatusConsumed A request status object or NULL. If not NULL, then the sl@0: * request status is completed once the receiver sl@0: * does not anymore need the contents of the sl@0: * surface to render the update. This may happen sl@0: * before actually displaying the finished frame. sl@0: * @param aStatusDisplayed This is signaled after the composited frame sl@0: * is posted the to display for the first time after sl@0: * the update. After this the value in sl@0: * aTimeStamp is valid, if the value in the sl@0: * status object is KErrNone. Can be NULL, if sl@0: * no signal is desired. sl@0: * @param aTimeStamp Value of the User::FastCounter() right after the sl@0: * display refresh that signaled aStatusDisplayed. sl@0: * @param aStatusDispXTimes This is signaled when the surface has been on sl@0: * the screen for aDisplayedXTimes refreshes, sl@0: * including the update that signaled aStatusDisplayed. sl@0: * Can be NULL, if no signal is wanted. sl@0: * @param aDisplayedXTimes The number of refreshes after which aStatusDispXTimes sl@0: * is signaled or NULL. If values is provided, it must be sl@0: * >= 1. sl@0: * sl@0: * @pre The MCompositionSurfaceUpdate implementation is waiting for content sl@0: * update notifications. sl@0: * @pre aSurface.IsNull() returns EFalse. sl@0: * @pre The surface aSurface is registered with the receiver or all status sl@0: * requests are completed with KErrArgument. sl@0: * @pre Either both aStatusDisplayed and aTimeStamp are NULL or neither sl@0: * of them are. sl@0: * @pre Either both aStatusDispXTimes and aDisplayedXTimes are NULL or sl@0: * neither of them are. sl@0: * @post The MCompositionSurfaceUpdate implementation is waiting for vsync sl@0: * or another synchronisation method to trigger composition, sl@0: * depending on cached visibility information. sl@0: * @note The updated region is used only as an optimisation hint. sl@0: * the current contents of the surface are always used for sl@0: * composition independent of the aRegion. sl@0: * @see Surface Update API Specification for further details sl@0: * about the semantics of the parameters and return values sl@0: * of the TRequestStatus objects. sl@0: *//*-------------------------------------------------------------------*/ sl@0: sl@0: virtual void ContentUpdated (const TSurfaceId& aSurface, sl@0: TInt aBuffer, sl@0: const TRegion* aRegion, sl@0: TRequestStatus* aStatusConsumed, sl@0: TRequestStatus* aStatusDisplayed, sl@0: TUint32* aTimeStamp, sl@0: TRequestStatus* aStatusDispXTimes, sl@0: TInt* aDisplayedXTimes) = 0; sl@0: public: sl@0: /** Get Extension Interface. sl@0: * Implemented using the CBase::Extension_() mechanism sl@0: * Note that the pointer returned is only good for the lifetime of the called CBase derived object. sl@0: * @param aExtensionId The GUID/ Well-known ID of the interface sl@0: * @return pointer to the interface or NULL if not available sl@0: **/ sl@0: inline TAny* GetInterface(TUint aExtensionId); sl@0: /** Get Extension Interface - templated helper. sl@0: * Resolves the ID and returned pointer based on the class name. sl@0: * Note that the pointer returned is only good for the lifetime of the called CBase derived object. sl@0: * Class name should support ETypeId intergral value, else use non-template version. sl@0: * @param MClass The class of the interface with embedded GUID / Well known ID sl@0: * @return pointer to the interface or NULL if not available sl@0: **/ sl@0: template MClass* GetInterface() sl@0: { sl@0: return static_cast(GetInterface(MClass::ETypeId)); sl@0: } sl@0: sl@0: protected: //From CBase sl@0: virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1)=0; sl@0: sl@0: }; sl@0: sl@0: inline TAny* MCompositionSurfaceUpdate::GetInterface(TUint aExtensionId) sl@0: { sl@0: TAny* retVal=NULL; sl@0: //Note that extension is intentionally not overloaded in MCompositionSurfaceUpdate sl@0: if (this->Extension_(aExtensionId,retVal,NULL)