os/graphics/graphicscomposition/openwfcompositionengine/composition/include/wfccontext.h
Update contrib.
1 /* Copyright (c) 2009 The Khronos Group Inc.
2 * Portions copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and/or associated documentation files (the
6 * "Materials"), to deal in the Materials without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Materials, and to
9 * permit persons to whom the Materials are furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Materials.
15 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27 * \brief Context handling interface
33 #include "wfcstructs.h"
34 #include "wfcdevice.h"
35 #include "owfscreen.h"
42 #define MAX_SOURCE_WIDTH OWF_SURFACE_WIDTH
43 #define MAX_SOURCE_HEIGHT OWF_SURFACE_HEIGHT
45 Initialize context attributes
46 \return ATTR_ERROR_NONE if attributes have been properly initialised.
48 OWF_API_CALL OWF_ATTRIBUTE_LIST_STATUS
49 WFC_Context_InitializeAttributes(WFC_CONTEXT* context,
53 * \brief Create new context on device
55 * \param device Device on which the context should be created
56 * \param type Context type (on- or off-screen)
58 * \return New context object or NULL in case of failure
60 OWF_API_CALL WFC_CONTEXT*
61 WFC_Context_Create(WFC_DEVICE* device,
62 WFCNativeStreamType stream,
66 * \brief Releases the resources associated with the context.
67 * Some of these resources hold reference-counts on the context,
68 * so this must be called BEFORE the main attempt to destroy the context.
70 * \param type Context type (on- or off-screen)
73 WFC_Context_Shutdown(WFC_CONTEXT* context);
76 * \brief Setup context rendering target
78 * \param context Context
79 * \param stream Target stream to use for rendering
82 WFC_Context_SetTargetStream(WFC_CONTEXT* context,
83 OWFNativeStreamType stream);
86 * \brief Checks if the given stream would be valid as an off-screen context target.
87 * Checks that the format can be rendered TO.
88 * Also checks that the image size is acceptable (within the scratch buffers).
89 * This is called before the context is created so is effectively a "static" context method.
91 * \param stream Target stream to use for rendering
93 OWF_API_CALL WFCboolean
94 WFC_Context_IsValidTargetStream(OWFNativeStreamType stream);
96 * \brief Checks that the image size is acceptable (within the scratch buffers).
97 * This is called before the source is created.
99 * \param stream source stream to use for rendering.
101 OWF_API_CALL WFCboolean
102 WFC_Context_IsValidSourceStream(OWFNativeStreamType stream);
104 * \brief Destroy all masks in context
106 * \param context Context
109 WFC_Context_DestroyMasks(WFC_CONTEXT* context);
112 * \brief Destroy all context sources
115 WFC_Context_DestroySources(WFC_CONTEXT* context);
118 * \brief Destroy all context elements
120 * \param context Context object
123 WFC_Context_DestroyElements(WFC_CONTEXT* context);
126 * \brief Find element from current scene
128 * \param context Context object
129 * \param element Element to find
131 * \return Element object or NULL if element hasn't been inserted
132 * into current scene.
134 OWF_API_CALL WFC_ELEMENT*
135 WFC_Context_FindElement(WFC_CONTEXT* context,
139 * \brief Activate/deactivate auto-composition on context
141 * \param context Context
142 * \param act Auto-composition enable/disable
145 WFC_Context_Activate(WFC_CONTEXT* context,
149 * \brief Insert composition request to command stream
153 * \param wait WFD_TRUE if executed synchronously
155 OWF_API_CALL WFCboolean
156 WFC_Context_InvokeComposition(WFC_DEVICE* device,
157 WFC_CONTEXT* context,
162 * \brief Insert commit request to command stream
166 * \param wait WFD_TRUE if executed synchronously
168 OWF_API_CALL WFCErrorCode
169 WFC_Context_InvokeCommit(WFC_DEVICE* device,
170 WFC_CONTEXT* context,
174 * \brief Insert fence token to context's command stream
181 WFC_Context_InsertFence(WFC_CONTEXT* context,
186 * \brief Create element
190 OWF_API_CALL WFC_ELEMENT*
191 WFC_Context_CreateElement(WFC_CONTEXT* context);
193 /*! \brief Destroy element
197 OWF_API_CALL WFCErrorCode
198 WFC_Context_DestroyElement(WFC_CONTEXT* context, WFCElement element);
201 * \brief IncreaseClientElementCount
204 * \return positive increased current element count; negative or zero indicating the count can't be increased
207 WFC_Context_IncreaseClientElementCount(WFC_CONTEXT* context);
210 * \brief DecreaseClientElementCount
213 * \return positive or zero decreased current element count; negative indicating the count can't be decreased - p0robably already zero
216 WFC_Context_DecreaseClientElementCount(WFC_CONTEXT* context);
219 * \brief Insert element into context's scene
225 * \return WFCErrorCode
227 OWF_API_CALL WFCErrorCode
228 WFC_Context_InsertElement(WFC_CONTEXT* context,
230 WFCElement subordinate);
233 * \brief Remove element from context's scene
238 * \return WFCErrorCode
240 OWF_API_CALL WFCErrorCode
241 WFC_Context_RemoveElement(WFC_CONTEXT* context,
245 * \brief Fetch the handle of the element that is above the given element.
250 * \return Error code. On return, the location pointed by result
251 * will contain handle of the element above OR WFC_INVALID_HANDLE,
252 * if no element is above given element.
254 OWF_API_CALL WFCErrorCode
255 WFC_Context_GetElementAbove(WFC_CONTEXT* context,
260 * \brief Fetch the handle of the element that is below the given element.
265 * \return Error code. On return, the location pointed by result
266 * will contain handle of the element below OR WFC_INVALID_HANDLE,
267 * if no element is below given element.
269 OWF_API_CALL WFCErrorCode
270 WFC_Context_GetElementBelow(WFC_CONTEXT* context,
275 * \brief Get context attribute value
281 * \return WFCErrorCode
283 OWF_API_CALL WFCErrorCode
284 WFC_Context_GetAttribi(WFC_CONTEXT* context,
285 WFCContextAttrib attrib,
289 * \brief Set context attribute value
295 * \return WFCErrorCode
297 OWF_API_CALL WFCErrorCode
298 WFC_Context_SetAttribi(WFC_CONTEXT* context,
299 WFCContextAttrib attrib,
303 * \brief Get context attribute value
309 * \return WFCErrorCode
311 OWF_API_CALL WFCErrorCode
312 WFC_Context_GetAttribfv(WFC_CONTEXT* context,
313 WFCContextAttrib attrib,
318 * \brief Set context attribute value
324 * \return WFCErrorCode
326 OWF_API_CALL WFCErrorCode
327 WFC_Context_SetAttribfv(WFC_CONTEXT* context,
328 WFCContextAttrib attrib,
330 const WFCfloat* values);
334 * \brief Check if context is currently activated
339 OWF_API_CALL WFCboolean
340 WFC_Context_Active(WFC_CONTEXT* context);
346 #endif /*WFCCONTEXT_H_*/