1 | /* $Id: cr_vreg.h 50754 2014-03-12 17:43:09Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * Visible Regions processing API
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2012 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 | #ifndef ___cr_vreg_h_
|
---|
19 | #define ___cr_vreg_h_
|
---|
20 |
|
---|
21 | #include <iprt/list.h>
|
---|
22 | #include <iprt/types.h>
|
---|
23 | #include <iprt/mem.h>
|
---|
24 | #include <iprt/string.h>
|
---|
25 | #include <iprt/assert.h>
|
---|
26 | #include <iprt/critsect.h>
|
---|
27 | #include <iprt/asm.h>
|
---|
28 |
|
---|
29 | #ifndef IN_RING0
|
---|
30 | # define VBOXVREGDECL(_type) DECLEXPORT(_type)
|
---|
31 | #else
|
---|
32 | # define VBOXVREGDECL(_type) RTDECL(_type)
|
---|
33 | #endif
|
---|
34 |
|
---|
35 |
|
---|
36 |
|
---|
37 | RT_C_DECLS_BEGIN
|
---|
38 |
|
---|
39 | typedef struct VBOXVR_LIST
|
---|
40 | {
|
---|
41 | RTLISTNODE ListHead;
|
---|
42 | uint32_t cEntries;
|
---|
43 | } VBOXVR_LIST, *PVBOXVR_LIST;
|
---|
44 |
|
---|
45 | DECLINLINE(int) VBoxRectCmp(const RTRECT * pRect1, const RTRECT * pRect2)
|
---|
46 | {
|
---|
47 | return memcmp(pRect1, pRect2, sizeof (*pRect1));
|
---|
48 | }
|
---|
49 |
|
---|
50 | #ifndef IN_RING0
|
---|
51 | #define CR_FLOAT_RCAST(_t, _v) ((_t)((float)(_v) + 0.5))
|
---|
52 |
|
---|
53 | DECLINLINE(void) VBoxRectScale(PRTRECT pRect, float xScale, float yScale)
|
---|
54 | {
|
---|
55 | pRect->xLeft = CR_FLOAT_RCAST(int32_t, pRect->xLeft * xScale);
|
---|
56 | pRect->yTop = CR_FLOAT_RCAST(int32_t, pRect->yTop * yScale);
|
---|
57 | pRect->xRight = CR_FLOAT_RCAST(int32_t, pRect->xRight * xScale);
|
---|
58 | pRect->yBottom = CR_FLOAT_RCAST(int32_t, pRect->yBottom * yScale);
|
---|
59 | }
|
---|
60 |
|
---|
61 | DECLINLINE(void) VBoxRectScaled(const RTRECT *pRect, float xScale, float yScale, PRTRECT pResult)
|
---|
62 | {
|
---|
63 | *pResult = *pRect;
|
---|
64 | VBoxRectScale(pResult, xScale, yScale);
|
---|
65 | }
|
---|
66 |
|
---|
67 | DECLINLINE(void) VBoxRectUnscale(PRTRECT pRect, float xScale, float yScale)
|
---|
68 | {
|
---|
69 | pRect->xLeft = CR_FLOAT_RCAST(int32_t, pRect->xLeft / xScale);
|
---|
70 | pRect->yTop = CR_FLOAT_RCAST(int32_t, pRect->yTop / yScale);
|
---|
71 | pRect->xRight = CR_FLOAT_RCAST(int32_t, pRect->xRight / xScale);
|
---|
72 | pRect->yBottom = CR_FLOAT_RCAST(int32_t, pRect->yBottom / yScale);
|
---|
73 | }
|
---|
74 |
|
---|
75 | DECLINLINE(void) VBoxRectUnscaled(const RTRECT *pRect, float xScale, float yScale, PRTRECT pResult)
|
---|
76 | {
|
---|
77 | *pResult = *pRect;
|
---|
78 | VBoxRectUnscale(pResult, xScale, yScale);
|
---|
79 | }
|
---|
80 | #endif
|
---|
81 |
|
---|
82 | DECLINLINE(void) VBoxRectIntersect(PRTRECT pRect1, const RTRECT * pRect2)
|
---|
83 | {
|
---|
84 | Assert(pRect1);
|
---|
85 | Assert(pRect2);
|
---|
86 | pRect1->xLeft = RT_MAX(pRect1->xLeft, pRect2->xLeft);
|
---|
87 | pRect1->yTop = RT_MAX(pRect1->yTop, pRect2->yTop);
|
---|
88 | pRect1->xRight = RT_MIN(pRect1->xRight, pRect2->xRight);
|
---|
89 | pRect1->yBottom = RT_MIN(pRect1->yBottom, pRect2->yBottom);
|
---|
90 | }
|
---|
91 |
|
---|
92 | DECLINLINE(void) VBoxRectIntersected(const RTRECT *pRect1, const RTRECT * pRect2, RTRECT *pResult)
|
---|
93 | {
|
---|
94 | *pResult = *pRect1;
|
---|
95 | VBoxRectIntersect(pResult, pRect2);
|
---|
96 | }
|
---|
97 |
|
---|
98 |
|
---|
99 | DECLINLINE(void) VBoxRectTranslate(RTRECT * pRect, int32_t x, int32_t y)
|
---|
100 | {
|
---|
101 | pRect->xLeft += x;
|
---|
102 | pRect->yTop += y;
|
---|
103 | pRect->xRight += x;
|
---|
104 | pRect->yBottom += y;
|
---|
105 | }
|
---|
106 |
|
---|
107 | DECLINLINE(void) VBoxRectTranslated(const RTRECT * pRect, int32_t x, int32_t y, RTRECT *pResult)
|
---|
108 | {
|
---|
109 | *pResult = *pRect;
|
---|
110 | VBoxRectTranslate(pResult, x, y);
|
---|
111 | }
|
---|
112 |
|
---|
113 | DECLINLINE(void) VBoxRectInvertY(RTRECT * pRect)
|
---|
114 | {
|
---|
115 | int32_t y = pRect->yTop;
|
---|
116 | pRect->yTop = pRect->yBottom;
|
---|
117 | pRect->yBottom = y;
|
---|
118 | }
|
---|
119 |
|
---|
120 | DECLINLINE(void) VBoxRectInvertedY(const RTRECT * pRect, RTRECT * pResult)
|
---|
121 | {
|
---|
122 | *pResult = *pRect;
|
---|
123 | VBoxRectInvertY(pResult);
|
---|
124 | }
|
---|
125 |
|
---|
126 | DECLINLINE(void) VBoxRectMove(RTRECT * pRect, int32_t x, int32_t y)
|
---|
127 | {
|
---|
128 | int32_t w = pRect->xRight - pRect->xLeft;
|
---|
129 | int32_t h = pRect->yBottom - pRect->yTop;
|
---|
130 | pRect->xLeft = x;
|
---|
131 | pRect->yTop = y;
|
---|
132 | pRect->xRight = w + x;
|
---|
133 | pRect->yBottom = h + y;
|
---|
134 | }
|
---|
135 |
|
---|
136 | DECLINLINE(void) VBoxRectMoved(const RTRECT * pRect, int32_t x, int32_t y, RTRECT *pResult)
|
---|
137 | {
|
---|
138 | *pResult = *pRect;
|
---|
139 | VBoxRectMove(pResult, x, y);
|
---|
140 | }
|
---|
141 |
|
---|
142 | DECLINLINE(bool) VBoxRectCovers(const RTRECT *pRect, const RTRECT *pCovered)
|
---|
143 | {
|
---|
144 | Assert(pRect);
|
---|
145 | Assert(pCovered);
|
---|
146 | if (pRect->xLeft > pCovered->xLeft)
|
---|
147 | return false;
|
---|
148 | if (pRect->yTop > pCovered->yTop)
|
---|
149 | return false;
|
---|
150 | if (pRect->xRight < pCovered->xRight)
|
---|
151 | return false;
|
---|
152 | if (pRect->yBottom < pCovered->yBottom)
|
---|
153 | return false;
|
---|
154 | return true;
|
---|
155 | }
|
---|
156 |
|
---|
157 | DECLINLINE(bool) VBoxRectIsZero(const RTRECT *pRect)
|
---|
158 | {
|
---|
159 | return pRect->xLeft == pRect->xRight || pRect->yTop == pRect->yBottom;
|
---|
160 | }
|
---|
161 |
|
---|
162 | DECLINLINE(bool) VBoxRectIsIntersect(const RTRECT * pRect1, const RTRECT * pRect2)
|
---|
163 | {
|
---|
164 | return !((pRect1->xLeft < pRect2->xLeft && pRect1->xRight <= pRect2->xLeft)
|
---|
165 | || (pRect2->xLeft < pRect1->xLeft && pRect2->xRight <= pRect1->xLeft)
|
---|
166 | || (pRect1->yTop < pRect2->yTop && pRect1->yBottom <= pRect2->yTop)
|
---|
167 | || (pRect2->yTop < pRect1->yTop && pRect2->yBottom <= pRect1->yTop));
|
---|
168 | }
|
---|
169 |
|
---|
170 | DECLINLINE(uint32_t) VBoxVrListRectsCount(const VBOXVR_LIST *pList)
|
---|
171 | {
|
---|
172 | return pList->cEntries;
|
---|
173 | }
|
---|
174 |
|
---|
175 | DECLINLINE(bool) VBoxVrListIsEmpty(const VBOXVR_LIST *pList)
|
---|
176 | {
|
---|
177 | return !VBoxVrListRectsCount(pList);
|
---|
178 | }
|
---|
179 |
|
---|
180 | DECLINLINE(void) VBoxVrListInit(PVBOXVR_LIST pList)
|
---|
181 | {
|
---|
182 | RTListInit(&pList->ListHead);
|
---|
183 | pList->cEntries = 0;
|
---|
184 | }
|
---|
185 |
|
---|
186 | VBOXVREGDECL(void) VBoxVrListClear(PVBOXVR_LIST pList);
|
---|
187 |
|
---|
188 | /* moves list data to pDstList and empties the pList */
|
---|
189 | VBOXVREGDECL(void) VBoxVrListMoveTo(PVBOXVR_LIST pList, PVBOXVR_LIST pDstList);
|
---|
190 |
|
---|
191 | VBOXVREGDECL(void) VBoxVrListTranslate(PVBOXVR_LIST pList, int32_t x, int32_t y);
|
---|
192 |
|
---|
193 | VBOXVREGDECL(int) VBoxVrListCmp(const VBOXVR_LIST *pList1, const VBOXVR_LIST *pList2);
|
---|
194 |
|
---|
195 | VBOXVREGDECL(int) VBoxVrListRectsSet(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
|
---|
196 | VBOXVREGDECL(int) VBoxVrListRectsAdd(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
|
---|
197 | VBOXVREGDECL(int) VBoxVrListRectsSubst(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
|
---|
198 | VBOXVREGDECL(int) VBoxVrListRectsGet(PVBOXVR_LIST pList, uint32_t cRects, RTRECT * aRects);
|
---|
199 |
|
---|
200 | VBOXVREGDECL(int) VBoxVrListClone(const VBOXVR_LIST *pList, VBOXVR_LIST *pDstList);
|
---|
201 |
|
---|
202 | /* NOTE: with the current implementation the VBoxVrListIntersect is faster than VBoxVrListRectsIntersect,
|
---|
203 | * i.e. VBoxVrListRectsIntersect is actually a convenience function that create a temporary list and calls VBoxVrListIntersect internally */
|
---|
204 | VBOXVREGDECL(int) VBoxVrListRectsIntersect(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
|
---|
205 | VBOXVREGDECL(int) VBoxVrListIntersect(PVBOXVR_LIST pList, const VBOXVR_LIST *pList2, bool *pfChanged);
|
---|
206 |
|
---|
207 | VBOXVREGDECL(int) VBoxVrInit(void);
|
---|
208 | VBOXVREGDECL(void) VBoxVrTerm(void);
|
---|
209 |
|
---|
210 | typedef struct VBOXVR_LIST_ITERATOR
|
---|
211 | {
|
---|
212 | PVBOXVR_LIST pList;
|
---|
213 | PRTLISTNODE pNextEntry;
|
---|
214 | } VBOXVR_LIST_ITERATOR, *PVBOXVR_LIST_ITERATOR;
|
---|
215 |
|
---|
216 | DECLINLINE(void) VBoxVrListIterInit(PVBOXVR_LIST pList, PVBOXVR_LIST_ITERATOR pIter)
|
---|
217 | {
|
---|
218 | pIter->pList = pList;
|
---|
219 | pIter->pNextEntry = pList->ListHead.pNext;
|
---|
220 | }
|
---|
221 |
|
---|
222 | typedef struct VBOXVR_REG
|
---|
223 | {
|
---|
224 | RTLISTNODE ListEntry;
|
---|
225 | RTRECT Rect;
|
---|
226 | } VBOXVR_REG, *PVBOXVR_REG;
|
---|
227 |
|
---|
228 | #define PVBOXVR_REG_FROM_ENTRY(_pEntry) ((PVBOXVR_REG)(((uint8_t*)(_pEntry)) - RT_OFFSETOF(VBOXVR_REG, ListEntry)))
|
---|
229 |
|
---|
230 | DECLINLINE(PCRTRECT) VBoxVrListIterNext(PVBOXVR_LIST_ITERATOR pIter)
|
---|
231 | {
|
---|
232 | PRTLISTNODE pNextEntry = pIter->pNextEntry;
|
---|
233 | if (pNextEntry != &pIter->pList->ListHead)
|
---|
234 | {
|
---|
235 | PCRTRECT pRect = &(PVBOXVR_REG_FROM_ENTRY(pNextEntry)->Rect);
|
---|
236 | pIter->pNextEntry = pNextEntry->pNext;
|
---|
237 | return pRect;
|
---|
238 | }
|
---|
239 | return NULL;
|
---|
240 | }
|
---|
241 |
|
---|
242 | typedef struct VBOXVR_COMPOSITOR_ENTRY
|
---|
243 | {
|
---|
244 | RTLISTNODE Node;
|
---|
245 | VBOXVR_LIST Vr;
|
---|
246 | uint32_t cRefs;
|
---|
247 | } VBOXVR_COMPOSITOR_ENTRY, *PVBOXVR_COMPOSITOR_ENTRY;
|
---|
248 |
|
---|
249 | struct VBOXVR_COMPOSITOR;
|
---|
250 |
|
---|
251 | typedef DECLCALLBACK(void) FNVBOXVRCOMPOSITOR_ENTRY_RELEASED(const struct VBOXVR_COMPOSITOR *pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, PVBOXVR_COMPOSITOR_ENTRY pReplacingEntry);
|
---|
252 | typedef FNVBOXVRCOMPOSITOR_ENTRY_RELEASED *PFNVBOXVRCOMPOSITOR_ENTRY_RELEASED;
|
---|
253 |
|
---|
254 | typedef struct VBOXVR_COMPOSITOR
|
---|
255 | {
|
---|
256 | RTLISTNODE List;
|
---|
257 | PFNVBOXVRCOMPOSITOR_ENTRY_RELEASED pfnEntryReleased;
|
---|
258 | } VBOXVR_COMPOSITOR, *PVBOXVR_COMPOSITOR;
|
---|
259 |
|
---|
260 | typedef DECLCALLBACK(bool) FNVBOXVRCOMPOSITOR_VISITOR(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, void *pvVisitor);
|
---|
261 | typedef FNVBOXVRCOMPOSITOR_VISITOR *PFNVBOXVRCOMPOSITOR_VISITOR;
|
---|
262 |
|
---|
263 | VBOXVREGDECL(void) VBoxVrCompositorInit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_ENTRY_RELEASED pfnEntryReleased);
|
---|
264 | VBOXVREGDECL(void) VBoxVrCompositorClear(PVBOXVR_COMPOSITOR pCompositor);
|
---|
265 | VBOXVREGDECL(void) VBoxVrCompositorRegionsClear(PVBOXVR_COMPOSITOR pCompositor, bool *pfChanged);
|
---|
266 | VBOXVREGDECL(void) VBoxVrCompositorEntryInit(PVBOXVR_COMPOSITOR_ENTRY pEntry);
|
---|
267 | DECLINLINE(bool) VBoxVrCompositorEntryIsInList(const VBOXVR_COMPOSITOR_ENTRY *pEntry)
|
---|
268 | {
|
---|
269 | return !VBoxVrListIsEmpty(&pEntry->Vr);
|
---|
270 | }
|
---|
271 |
|
---|
272 | #define CRBLT_F_LINEAR 0x00000001
|
---|
273 | #define CRBLT_F_INVERT_SRC_YCOORDS 0x00000002
|
---|
274 | #define CRBLT_F_INVERT_DST_YCOORDS 0x00000004
|
---|
275 | #define CRBLT_F_INVERT_YCOORDS (CRBLT_F_INVERT_SRC_YCOORDS | CRBLT_F_INVERT_DST_YCOORDS)
|
---|
276 | /* the blit operation with discard the source alpha channel values and set the destination alpha values to 1.0 */
|
---|
277 | #define CRBLT_F_NOALPHA 0x00000010
|
---|
278 |
|
---|
279 | #define CRBLT_FTYPE_XOR CRBLT_F_INVERT_YCOORDS
|
---|
280 | #define CRBLT_FTYPE_OR (CRBLT_F_LINEAR | CRBLT_F_NOALPHA)
|
---|
281 | #define CRBLT_FOP_COMBINE(_f1, _f2) ((((_f1) ^ (_f2)) & CRBLT_FTYPE_XOR) | (((_f1) | (_f2)) & CRBLT_FTYPE_OR))
|
---|
282 |
|
---|
283 | #define CRBLT_FLAGS_FROM_FILTER(_f) ( ((_f) & GL_LINEAR) ? CRBLT_F_LINEAR : 0)
|
---|
284 | #define CRBLT_FILTER_FROM_FLAGS(_f) (((_f) & CRBLT_F_LINEAR) ? GL_LINEAR : GL_NEAREST)
|
---|
285 |
|
---|
286 | /* compositor regions changed */
|
---|
287 | #define VBOXVR_COMPOSITOR_CF_REGIONS_CHANGED 0x00000001
|
---|
288 | /* other entries changed along while doing current entry modification
|
---|
289 | * always comes with VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED */
|
---|
290 | #define VBOXVR_COMPOSITOR_CF_OTHER_ENTRIES_REGIONS_CHANGED 0x00000002
|
---|
291 | /* only current entry regions changed
|
---|
292 | * can come wither with VBOXVR_COMPOSITOR_CF_REGIONS_CHANGED or with VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED */
|
---|
293 | #define VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED 0x00000004
|
---|
294 | /* the given entry has replaced some other entry, while overal regions did NOT change.
|
---|
295 | * always comes with VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED */
|
---|
296 | #define VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED 0x00000008
|
---|
297 |
|
---|
298 |
|
---|
299 | VBOXVREGDECL(bool) VBoxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry);
|
---|
300 | VBOXVREGDECL(bool) VBoxVrCompositorEntryReplace(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, PVBOXVR_COMPOSITOR_ENTRY pNewEntry);
|
---|
301 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsAdd(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, PVBOXVR_COMPOSITOR_ENTRY *ppReplacedEntry, uint32_t *pfChangeFlags);
|
---|
302 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSubst(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
|
---|
303 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSet(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
|
---|
304 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsIntersect(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
|
---|
305 | VBOXVREGDECL(int) VBoxVrCompositorEntryListIntersect(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, const VBOXVR_LIST *pList2, bool *pfChanged);
|
---|
306 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsIntersectAll(PVBOXVR_COMPOSITOR pCompositor, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
|
---|
307 | VBOXVREGDECL(int) VBoxVrCompositorEntryListIntersectAll(PVBOXVR_COMPOSITOR pCompositor, const VBOXVR_LIST *pList2, bool *pfChanged);
|
---|
308 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsTranslate(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, int32_t x, int32_t y, bool *pfChanged);
|
---|
309 | VBOXVREGDECL(void) VBoxVrCompositorVisit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_VISITOR pfnVisitor, void *pvVisitor);
|
---|
310 |
|
---|
311 | DECLINLINE(bool) VBoxVrCompositorIsEmpty(const VBOXVR_COMPOSITOR *pCompositor)
|
---|
312 | {
|
---|
313 | return RTListIsEmpty(&pCompositor->List);
|
---|
314 | }
|
---|
315 |
|
---|
316 | typedef struct VBOXVR_COMPOSITOR_ITERATOR
|
---|
317 | {
|
---|
318 | PVBOXVR_COMPOSITOR pCompositor;
|
---|
319 | PRTLISTNODE pNextEntry;
|
---|
320 | } VBOXVR_COMPOSITOR_ITERATOR ,*PVBOXVR_COMPOSITOR_ITERATOR;
|
---|
321 |
|
---|
322 | typedef struct VBOXVR_COMPOSITOR_CONST_ITERATOR
|
---|
323 | {
|
---|
324 | const VBOXVR_COMPOSITOR *pCompositor;
|
---|
325 | const RTLISTNODE *pNextEntry;
|
---|
326 | } VBOXVR_COMPOSITOR_CONST_ITERATOR ,*PVBOXVR_COMPOSITOR_CONST_ITERATOR;
|
---|
327 |
|
---|
328 | DECLINLINE(void) VBoxVrCompositorIterInit(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ITERATOR pIter)
|
---|
329 | {
|
---|
330 | pIter->pCompositor = pCompositor;
|
---|
331 | pIter->pNextEntry = pCompositor->List.pNext;
|
---|
332 | }
|
---|
333 |
|
---|
334 | DECLINLINE(void) VBoxVrCompositorConstIterInit(const VBOXVR_COMPOSITOR *pCompositor, PVBOXVR_COMPOSITOR_CONST_ITERATOR pIter)
|
---|
335 | {
|
---|
336 | pIter->pCompositor = pCompositor;
|
---|
337 | pIter->pNextEntry = pCompositor->List.pNext;
|
---|
338 | }
|
---|
339 |
|
---|
340 | #define VBOXVR_COMPOSITOR_ENTRY_FROM_NODE(_p) ((PVBOXVR_COMPOSITOR_ENTRY)(((uint8_t*)(_p)) - RT_OFFSETOF(VBOXVR_COMPOSITOR_ENTRY, Node)))
|
---|
341 | #define VBOXVR_COMPOSITOR_CONST_ENTRY_FROM_NODE(_p) ((const VBOXVR_COMPOSITOR_ENTRY*)(((uint8_t*)(_p)) - RT_OFFSETOF(VBOXVR_COMPOSITOR_ENTRY, Node)))
|
---|
342 |
|
---|
343 | DECLINLINE(PVBOXVR_COMPOSITOR_ENTRY) VBoxVrCompositorIterNext(PVBOXVR_COMPOSITOR_ITERATOR pIter)
|
---|
344 | {
|
---|
345 | PRTLISTNODE pNextEntry = pIter->pNextEntry;
|
---|
346 | if (pNextEntry != &pIter->pCompositor->List)
|
---|
347 | {
|
---|
348 | PVBOXVR_COMPOSITOR_ENTRY pEntry = VBOXVR_COMPOSITOR_ENTRY_FROM_NODE(pNextEntry);
|
---|
349 | pIter->pNextEntry = pNextEntry->pNext;
|
---|
350 | return pEntry;
|
---|
351 | }
|
---|
352 | return NULL;
|
---|
353 | }
|
---|
354 |
|
---|
355 | DECLINLINE(const VBOXVR_COMPOSITOR_ENTRY*) VBoxVrCompositorConstIterNext(PVBOXVR_COMPOSITOR_CONST_ITERATOR pIter)
|
---|
356 | {
|
---|
357 | const RTLISTNODE *pNextEntry = pIter->pNextEntry;
|
---|
358 | if (pNextEntry != &pIter->pCompositor->List)
|
---|
359 | {
|
---|
360 | const VBOXVR_COMPOSITOR_ENTRY *pEntry = VBOXVR_COMPOSITOR_CONST_ENTRY_FROM_NODE(pNextEntry);
|
---|
361 | pIter->pNextEntry = pNextEntry->pNext;
|
---|
362 | return pEntry;
|
---|
363 | }
|
---|
364 | return NULL;
|
---|
365 | }
|
---|
366 |
|
---|
367 | typedef struct VBOXVR_TEXTURE
|
---|
368 | {
|
---|
369 | int32_t width;
|
---|
370 | int32_t height;
|
---|
371 | uint32_t target;
|
---|
372 | uint32_t hwid;
|
---|
373 | } VBOXVR_TEXTURE, *PVBOXVR_TEXTURE;
|
---|
374 |
|
---|
375 | RT_C_DECLS_END
|
---|
376 |
|
---|
377 | #endif /* #ifndef ___cr_vreg_h_ */
|
---|