sl@0
|
1 |
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// CompositionSurfaceUpdate.h
|
sl@0
|
15 |
// Interface to be implemented and registered with SUS by listener for surface content update messages.
|
sl@0
|
16 |
//
|
sl@0
|
17 |
#ifndef __COMPOSITIONSURFACEUPDATE_H__
|
sl@0
|
18 |
#define __COMPOSITIONSURFACEUPDATE_H__
|
sl@0
|
19 |
|
sl@0
|
20 |
/**
|
sl@0
|
21 |
* \brief Interface to implement and register with SUS to receive ContentUpdated() notifications.
|
sl@0
|
22 |
*
|
sl@0
|
23 |
*
|
sl@0
|
24 |
**/
|
sl@0
|
25 |
NONSHARABLE_CLASS(MCompositionSurfaceUpdate)
|
sl@0
|
26 |
{
|
sl@0
|
27 |
public:
|
sl@0
|
28 |
enum
|
sl@0
|
29 |
{
|
sl@0
|
30 |
KUidCompositionSurfaceUpdate = 0x10286498,
|
sl@0
|
31 |
ETypeId= KUidCompositionSurfaceUpdate
|
sl@0
|
32 |
};
|
sl@0
|
33 |
/*-------------------------------------------------------------------*//*!
|
sl@0
|
34 |
* \brief Gets the API version number of the
|
sl@0
|
35 |
* implementation.
|
sl@0
|
36 |
*
|
sl@0
|
37 |
* @return 1 for Oghma conformant implementation,
|
sl@0
|
38 |
* 2 for Sphinx (Maybe).
|
sl@0
|
39 |
* 3 for Native Stream first version.
|
sl@0
|
40 |
*//*-------------------------------------------------------------------*/
|
sl@0
|
41 |
|
sl@0
|
42 |
virtual TInt ApiVersion (void) = 0;
|
sl@0
|
43 |
|
sl@0
|
44 |
/*-------------------------------------------------------------------*//*!
|
sl@0
|
45 |
* \brief Gets the internal version number of the
|
sl@0
|
46 |
* implementation.
|
sl@0
|
47 |
*
|
sl@0
|
48 |
* @return The version number of the
|
sl@0
|
49 |
* instance.
|
sl@0
|
50 |
*//*-------------------------------------------------------------------*/
|
sl@0
|
51 |
|
sl@0
|
52 |
virtual TVersion InternalVersion (void) = 0;
|
sl@0
|
53 |
|
sl@0
|
54 |
/*-------------------------------------------------------------------*//*!
|
sl@0
|
55 |
* \brief A function that responds to surface content notifications.
|
sl@0
|
56 |
*
|
sl@0
|
57 |
* When the contents of a surface change, this function gets called
|
sl@0
|
58 |
* by a mechanism that is an implementation detail of the graphics
|
sl@0
|
59 |
* driver together with the Native Stream and Compositor implementations.
|
sl@0
|
60 |
* The call can originate from different processes and the
|
sl@0
|
61 |
* Native Stream together with the Compositor implementation
|
sl@0
|
62 |
* relays the information content of it, through implementation
|
sl@0
|
63 |
* specific means, to trigger the actual composition soon after this
|
sl@0
|
64 |
* call - this composition call should be synchronized with the
|
sl@0
|
65 |
* refresh rate of the screen.
|
sl@0
|
66 |
*
|
sl@0
|
67 |
* @param aSurface The surface that has been updated.
|
sl@0
|
68 |
* @param aBuffer The buffer of the surface to be used in
|
sl@0
|
69 |
* composition. Integer starting from 0.
|
sl@0
|
70 |
* @param aRegion The sub-area that has the updates. If NULL, the
|
sl@0
|
71 |
* whole surface is considered changed.
|
sl@0
|
72 |
* @param aStatusConsumed A request status object or NULL. If not NULL, then the
|
sl@0
|
73 |
* request status is completed once the receiver
|
sl@0
|
74 |
* does not anymore need the contents of the
|
sl@0
|
75 |
* surface to render the update. This may happen
|
sl@0
|
76 |
* before actually displaying the finished frame.
|
sl@0
|
77 |
* @param aStatusDisplayed This is signaled after the composited frame
|
sl@0
|
78 |
* is posted the to display for the first time after
|
sl@0
|
79 |
* the update. After this the value in
|
sl@0
|
80 |
* aTimeStamp is valid, if the value in the
|
sl@0
|
81 |
* status object is KErrNone. Can be NULL, if
|
sl@0
|
82 |
* no signal is desired.
|
sl@0
|
83 |
* @param aTimeStamp Value of the User::FastCounter() right after the
|
sl@0
|
84 |
* display refresh that signaled aStatusDisplayed.
|
sl@0
|
85 |
* @param aStatusDispXTimes This is signaled when the surface has been on
|
sl@0
|
86 |
* the screen for aDisplayedXTimes refreshes,
|
sl@0
|
87 |
* including the update that signaled aStatusDisplayed.
|
sl@0
|
88 |
* Can be NULL, if no signal is wanted.
|
sl@0
|
89 |
* @param aDisplayedXTimes The number of refreshes after which aStatusDispXTimes
|
sl@0
|
90 |
* is signaled or NULL. If values is provided, it must be
|
sl@0
|
91 |
* >= 1.
|
sl@0
|
92 |
*
|
sl@0
|
93 |
* @pre The MCompositionSurfaceUpdate implementation is waiting for content
|
sl@0
|
94 |
* update notifications.
|
sl@0
|
95 |
* @pre aSurface.IsNull() returns EFalse.
|
sl@0
|
96 |
* @pre The surface aSurface is registered with the receiver or all status
|
sl@0
|
97 |
* requests are completed with KErrArgument.
|
sl@0
|
98 |
* @pre Either both aStatusDisplayed and aTimeStamp are NULL or neither
|
sl@0
|
99 |
* of them are.
|
sl@0
|
100 |
* @pre Either both aStatusDispXTimes and aDisplayedXTimes are NULL or
|
sl@0
|
101 |
* neither of them are.
|
sl@0
|
102 |
* @post The MCompositionSurfaceUpdate implementation is waiting for vsync
|
sl@0
|
103 |
* or another synchronisation method to trigger composition,
|
sl@0
|
104 |
* depending on cached visibility information.
|
sl@0
|
105 |
* @note The updated region is used only as an optimisation hint.
|
sl@0
|
106 |
* the current contents of the surface are always used for
|
sl@0
|
107 |
* composition independent of the aRegion.
|
sl@0
|
108 |
* @see Surface Update API Specification for further details
|
sl@0
|
109 |
* about the semantics of the parameters and return values
|
sl@0
|
110 |
* of the TRequestStatus objects.
|
sl@0
|
111 |
*//*-------------------------------------------------------------------*/
|
sl@0
|
112 |
|
sl@0
|
113 |
virtual void ContentUpdated (const TSurfaceId& aSurface,
|
sl@0
|
114 |
TInt aBuffer,
|
sl@0
|
115 |
const TRegion* aRegion,
|
sl@0
|
116 |
TRequestStatus* aStatusConsumed,
|
sl@0
|
117 |
TRequestStatus* aStatusDisplayed,
|
sl@0
|
118 |
TUint32* aTimeStamp,
|
sl@0
|
119 |
TRequestStatus* aStatusDispXTimes,
|
sl@0
|
120 |
TInt* aDisplayedXTimes) = 0;
|
sl@0
|
121 |
public:
|
sl@0
|
122 |
/** Get Extension Interface.
|
sl@0
|
123 |
* Implemented using the CBase::Extension_() mechanism
|
sl@0
|
124 |
* Note that the pointer returned is only good for the lifetime of the called CBase derived object.
|
sl@0
|
125 |
* @param aExtensionId The GUID/ Well-known ID of the interface
|
sl@0
|
126 |
* @return pointer to the interface or NULL if not available
|
sl@0
|
127 |
**/
|
sl@0
|
128 |
inline TAny* GetInterface(TUint aExtensionId);
|
sl@0
|
129 |
/** Get Extension Interface - templated helper.
|
sl@0
|
130 |
* Resolves the ID and returned pointer based on the class name.
|
sl@0
|
131 |
* Note that the pointer returned is only good for the lifetime of the called CBase derived object.
|
sl@0
|
132 |
* Class name should support ETypeId intergral value, else use non-template version.
|
sl@0
|
133 |
* @param MClass The class of the interface with embedded GUID / Well known ID
|
sl@0
|
134 |
* @return pointer to the interface or NULL if not available
|
sl@0
|
135 |
**/
|
sl@0
|
136 |
template <class MClass> MClass* GetInterface()
|
sl@0
|
137 |
{
|
sl@0
|
138 |
return static_cast<MClass*>(GetInterface(MClass::ETypeId));
|
sl@0
|
139 |
}
|
sl@0
|
140 |
|
sl@0
|
141 |
protected: //From CBase
|
sl@0
|
142 |
virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1)=0;
|
sl@0
|
143 |
|
sl@0
|
144 |
};
|
sl@0
|
145 |
|
sl@0
|
146 |
inline TAny* MCompositionSurfaceUpdate::GetInterface(TUint aExtensionId)
|
sl@0
|
147 |
{
|
sl@0
|
148 |
TAny* retVal=NULL;
|
sl@0
|
149 |
//Note that extension is intentionally not overloaded in MCompositionSurfaceUpdate
|
sl@0
|
150 |
if (this->Extension_(aExtensionId,retVal,NULL)<KErrNone)
|
sl@0
|
151 |
{
|
sl@0
|
152 |
return NULL;
|
sl@0
|
153 |
}
|
sl@0
|
154 |
else
|
sl@0
|
155 |
{
|
sl@0
|
156 |
return retVal;
|
sl@0
|
157 |
}
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
#endif //__COMPOSITIONSURFACEUPDATE_H__
|