VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/include/cr_vreg.h@ 44124

Last change on this file since 44124 was 43888, checked in by vboxsync, 12 years ago

crOpenGL: more new present mechanism

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 KB
Line 
1/* $Id: cr_vreg.h 43888 2012-11-15 21:23:50Z 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
27#ifndef IN_RING0
28# define VBOXVREGDECL(_type) DECLEXPORT(_type)
29#else
30# define VBOXVREGDECL(_type) RTDECL(_type)
31#endif
32
33
34
35RT_C_DECLS_BEGIN
36
37typedef struct VBOXVR_LIST
38{
39 RTLISTNODE ListHead;
40 uint32_t cEntries;
41} VBOXVR_LIST, *PVBOXVR_LIST;
42
43DECLINLINE(int) VBoxRectCmp(const RTRECT * pRect1, const RTRECT * pRect2)
44{
45 return memcmp(pRect1, pRect2, sizeof (*pRect1));
46}
47
48DECLINLINE(void) VBoxRectTranslate(RTRECT * pRect, int32_t x, int32_t y)
49{
50 pRect->xLeft += x;
51 pRect->yTop += y;
52 pRect->xRight += x;
53 pRect->yBottom += y;
54}
55
56DECLINLINE(void) VBoxRectMove(RTRECT * pRect, int32_t x, int32_t y)
57{
58 int32_t w = pRect->xRight - pRect->xLeft;
59 int32_t h = pRect->yBottom - pRect->yTop;
60 pRect->xLeft = x;
61 pRect->yTop = y;
62 pRect->xRight = w + x;
63 pRect->yBottom = h + y;
64}
65
66DECLINLINE(bool) VBoxRectIsCoveres(const RTRECT *pRect, const RTRECT *pCovered)
67{
68 Assert(pRect);
69 Assert(pCovered);
70 if (pRect->xLeft > pCovered->xLeft)
71 return false;
72 if (pRect->yTop > pCovered->yTop)
73 return false;
74 if (pRect->xRight < pCovered->xRight)
75 return false;
76 if (pRect->yBottom < pCovered->yBottom)
77 return false;
78 return true;
79}
80
81DECLINLINE(bool) VBoxRectIsIntersect(const RTRECT * pRect1, const RTRECT * pRect2)
82{
83 return !((pRect1->xLeft < pRect2->xLeft && pRect1->xRight <= pRect2->xLeft)
84 || (pRect2->xLeft < pRect1->xLeft && pRect2->xRight <= pRect1->xLeft)
85 || (pRect1->yTop < pRect2->yTop && pRect1->yBottom <= pRect2->yTop)
86 || (pRect2->yTop < pRect1->yTop && pRect2->yBottom <= pRect1->yTop));
87}
88
89DECLINLINE(uint32_t) VBoxVrListRectsCount(PVBOXVR_LIST pList)
90{
91 return pList->cEntries;
92}
93
94DECLINLINE(bool) VBoxVrListIsEmpty(const PVBOXVR_LIST pList)
95{
96 return !VBoxVrListRectsCount(pList);
97}
98
99DECLINLINE(void) VBoxVrListInit(PVBOXVR_LIST pList)
100{
101 RTListInit(&pList->ListHead);
102 pList->cEntries = 0;
103}
104
105VBOXVREGDECL(void) VBoxVrListClear(PVBOXVR_LIST pList);
106
107VBOXVREGDECL(void) VBoxVrListTranslate(PVBOXVR_LIST pList, int32_t x, int32_t y);
108
109VBOXVREGDECL(int) VBoxVrListCmp(PVBOXVR_LIST pList1, PVBOXVR_LIST pList2);
110
111VBOXVREGDECL(int) VBoxVrListRectsAdd(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
112VBOXVREGDECL(int) VBoxVrListRectsSubst(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
113VBOXVREGDECL(int) VBoxVrListRectsGet(PVBOXVR_LIST pList, uint32_t cRects, RTRECT * aRects);
114
115VBOXVREGDECL(int) VBoxVrInit();
116VBOXVREGDECL(void) VBoxVrTerm();
117
118typedef struct VBOXVR_COMPOSITOR_ENTRY
119{
120 RTLISTNODE Node;
121 VBOXVR_LIST Vr;
122} VBOXVR_COMPOSITOR_ENTRY, *PVBOXVR_COMPOSITOR_ENTRY;
123
124struct VBOXVR_COMPOSITOR;
125
126typedef DECLCALLBACK(void) FNVBOXVRCOMPOSITOR_ENTRY_REMOVED(const struct VBOXVR_COMPOSITOR *pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, PVBOXVR_COMPOSITOR_ENTRY pReplacingEntry);
127typedef FNVBOXVRCOMPOSITOR_ENTRY_REMOVED *PFNVBOXVRCOMPOSITOR_ENTRY_REMOVED;
128
129typedef struct VBOXVR_COMPOSITOR
130{
131 RTLISTNODE List;
132 PFNVBOXVRCOMPOSITOR_ENTRY_REMOVED pfnEntryRemoved;
133} VBOXVR_COMPOSITOR, *PVBOXVR_COMPOSITOR;
134
135typedef DECLCALLBACK(bool) FNVBOXVRCOMPOSITOR_VISITOR(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, void *pvVisitor);
136typedef FNVBOXVRCOMPOSITOR_VISITOR *PFNVBOXVRCOMPOSITOR_VISITOR;
137
138VBOXVREGDECL(void) VBoxVrCompositorInit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_ENTRY_REMOVED pfnEntryRemoved);
139VBOXVREGDECL(void) VBoxVrCompositorTerm(PVBOXVR_COMPOSITOR pCompositor);
140VBOXVREGDECL(void) VBoxVrCompositorEntryInit(PVBOXVR_COMPOSITOR_ENTRY pEntry);
141DECLINLINE(bool) VBoxVrCompositorEntryIsInList(const PVBOXVR_COMPOSITOR_ENTRY pEntry)
142{
143 return !VBoxVrListIsEmpty(&pEntry->Vr);
144}
145
146#define VBOXVR_COMPOSITOR_CF_ENTRIES_REGIONS_CHANGED 0x00000001
147#define VBOXVR_COMPOSITOR_CF_COMPOSITED_REGIONS_CHANGED 0x00000002
148
149VBOXVREGDECL(bool) VBoxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry);
150VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsAdd(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, uint32_t *pfChangeFlags);
151VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSubst(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
152VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSet(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
153VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsTranslate(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, int32_t x, int32_t y, bool *pfChanged);
154VBOXVREGDECL(void) VBoxVrCompositorVisit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_VISITOR pfnVisitor, void *pvVisitor);
155
156RT_C_DECLS_END
157
158#endif /* #ifndef ___cr_vreg_h_ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette