1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox Windows NT/2000/XP guest video driver
|
---|
4 | *
|
---|
5 | * VBVA dirty rectangles calculations.
|
---|
6 | *
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | *
|
---|
21 | */
|
---|
22 |
|
---|
23 | #include "driver.h"
|
---|
24 |
|
---|
25 | void vboxReportDirtyRect (PPDEV ppdev, RECTL *pRect)
|
---|
26 | {
|
---|
27 | if (ppdev)
|
---|
28 | {
|
---|
29 | VBVACMDHDR hdr;
|
---|
30 |
|
---|
31 | hdr.x = (int16_t)pRect->left;
|
---|
32 | hdr.y = (int16_t)pRect->top;
|
---|
33 | hdr.w = (uint16_t)(pRect->right - pRect->left);
|
---|
34 | hdr.h = (uint16_t)(pRect->bottom - pRect->top);
|
---|
35 |
|
---|
36 | vboxWrite (ppdev, &hdr, sizeof(hdr));
|
---|
37 | }
|
---|
38 |
|
---|
39 | return;
|
---|
40 | }
|
---|
41 |
|
---|
42 | void vbvaReportDirtyRect (PPDEV ppdev, RECTL *prcl)
|
---|
43 | {
|
---|
44 | if (prcl)
|
---|
45 | {
|
---|
46 | DISPDBG((1, "DISP VBVA dirty rect: left %d, top: %d, width: %d, height: %d\n",
|
---|
47 | prcl->left, prcl->top, prcl->right - prcl->left, prcl->bottom - prcl->top));
|
---|
48 |
|
---|
49 | vboxReportDirtyRect(ppdev, prcl);
|
---|
50 | }
|
---|
51 | }
|
---|
52 |
|
---|
53 | void vbvaReportDirtyPath (PPDEV ppdev, PATHOBJ *ppo)
|
---|
54 | {
|
---|
55 | RECTFX rcfxBounds;
|
---|
56 | RECTL rclBounds;
|
---|
57 |
|
---|
58 | PATHOBJ_vGetBounds(ppo, &rcfxBounds);
|
---|
59 |
|
---|
60 | rclBounds.left = FXTOLFLOOR(rcfxBounds.xLeft);
|
---|
61 | rclBounds.right = FXTOLCEILING(rcfxBounds.xRight);
|
---|
62 | rclBounds.top = FXTOLFLOOR(rcfxBounds.yTop);
|
---|
63 | rclBounds.bottom = FXTOLCEILING(rcfxBounds.yBottom);
|
---|
64 |
|
---|
65 | vbvaReportDirtyRect (ppdev, &rclBounds);
|
---|
66 | }
|
---|
67 |
|
---|
68 | __inline void vbvaReportDirtyClip (PPDEV ppdev, CLIPOBJ *pco, RECTL *prcl)
|
---|
69 | {
|
---|
70 | if (prcl)
|
---|
71 | {
|
---|
72 | vbvaReportDirtyRect (ppdev, prcl);
|
---|
73 | }
|
---|
74 | else if (pco)
|
---|
75 | {
|
---|
76 | vbvaReportDirtyRect (ppdev, &pco->rclBounds);
|
---|
77 | }
|
---|
78 | }
|
---|
79 |
|
---|
80 |
|
---|
81 | void vbvaBitBlt (
|
---|
82 | SURFOBJ *psoTrg,
|
---|
83 | SURFOBJ *psoSrc,
|
---|
84 | SURFOBJ *psoMask,
|
---|
85 | CLIPOBJ *pco,
|
---|
86 | XLATEOBJ *pxlo,
|
---|
87 | RECTL *prclTrg,
|
---|
88 | POINTL *pptlSrc,
|
---|
89 | POINTL *pptlMask,
|
---|
90 | BRUSHOBJ *pbo,
|
---|
91 | POINTL *pptlBrush,
|
---|
92 | ROP4 rop4)
|
---|
93 | {
|
---|
94 | PPDEV ppdev = (PPDEV)psoTrg->dhpdev;
|
---|
95 |
|
---|
96 | vbvaReportDirtyRect (ppdev, prclTrg);
|
---|
97 | }
|
---|
98 |
|
---|
99 | void vbvaTextOut(
|
---|
100 | SURFOBJ *pso,
|
---|
101 | STROBJ *pstro,
|
---|
102 | FONTOBJ *pfo,
|
---|
103 | CLIPOBJ *pco,
|
---|
104 | RECTL *prclExtra, // Obsolete, always NULL
|
---|
105 | RECTL *prclOpaque,
|
---|
106 | BRUSHOBJ *pboFore,
|
---|
107 | BRUSHOBJ *pboOpaque,
|
---|
108 | POINTL *pptlOrg,
|
---|
109 | MIX mix
|
---|
110 | )
|
---|
111 | {
|
---|
112 | PPDEV ppdev = (PPDEV)pso->dhpdev;
|
---|
113 |
|
---|
114 | vbvaReportDirtyClip (ppdev, pco, prclOpaque? prclOpaque: &pstro->rclBkGround);
|
---|
115 | }
|
---|
116 |
|
---|
117 | void vbvaLineTo(
|
---|
118 | SURFOBJ *pso,
|
---|
119 | CLIPOBJ *pco,
|
---|
120 | BRUSHOBJ *pbo,
|
---|
121 | LONG x1,
|
---|
122 | LONG y1,
|
---|
123 | LONG x2,
|
---|
124 | LONG y2,
|
---|
125 | RECTL *prclBounds,
|
---|
126 | MIX mix
|
---|
127 | )
|
---|
128 | {
|
---|
129 | PPDEV ppdev = (PPDEV)pso->dhpdev;
|
---|
130 |
|
---|
131 | vbvaReportDirtyClip (ppdev, pco, prclBounds);
|
---|
132 | }
|
---|
133 |
|
---|
134 | void vbvaStretchBlt(
|
---|
135 | SURFOBJ *psoDest,
|
---|
136 | SURFOBJ *psoSrc,
|
---|
137 | SURFOBJ *psoMask,
|
---|
138 | CLIPOBJ *pco,
|
---|
139 | XLATEOBJ *pxlo,
|
---|
140 | COLORADJUSTMENT *pca,
|
---|
141 | POINTL *pptlHTOrg,
|
---|
142 | RECTL *prclDest,
|
---|
143 | RECTL *prclSrc,
|
---|
144 | POINTL *pptlMask,
|
---|
145 | ULONG iMode
|
---|
146 | )
|
---|
147 | {
|
---|
148 | PPDEV ppdev = (PPDEV)psoDest->dhpdev;
|
---|
149 |
|
---|
150 | vbvaReportDirtyClip (ppdev, pco, prclDest);
|
---|
151 | }
|
---|
152 |
|
---|
153 | void vbvaCopyBits(
|
---|
154 | SURFOBJ *psoDest,
|
---|
155 | SURFOBJ *psoSrc,
|
---|
156 | CLIPOBJ *pco,
|
---|
157 | XLATEOBJ *pxlo,
|
---|
158 | RECTL *prclDest,
|
---|
159 | POINTL *pptlSrc
|
---|
160 | )
|
---|
161 | {
|
---|
162 | PPDEV ppdev = (PPDEV)psoDest->dhpdev;
|
---|
163 |
|
---|
164 | vbvaReportDirtyClip (ppdev, pco, prclDest);
|
---|
165 | }
|
---|
166 |
|
---|
167 | void vbvaPaint(
|
---|
168 | SURFOBJ *pso,
|
---|
169 | CLIPOBJ *pco,
|
---|
170 | BRUSHOBJ *pbo,
|
---|
171 | POINTL *pptlBrushOrg,
|
---|
172 | MIX mix
|
---|
173 | )
|
---|
174 | {
|
---|
175 | PPDEV ppdev = (PPDEV)pso->dhpdev;
|
---|
176 |
|
---|
177 | vbvaReportDirtyClip (ppdev, pco, NULL);
|
---|
178 | }
|
---|
179 |
|
---|
180 | void vbvaFillPath(
|
---|
181 | SURFOBJ *pso,
|
---|
182 | PATHOBJ *ppo,
|
---|
183 | CLIPOBJ *pco,
|
---|
184 | BRUSHOBJ *pbo,
|
---|
185 | POINTL *pptlBrushOrg,
|
---|
186 | MIX mix,
|
---|
187 | FLONG flOptions
|
---|
188 | )
|
---|
189 | {
|
---|
190 | PPDEV ppdev = (PPDEV)pso->dhpdev;
|
---|
191 |
|
---|
192 | vbvaReportDirtyPath (ppdev, ppo);
|
---|
193 | }
|
---|
194 |
|
---|
195 | void vbvaStrokePath(
|
---|
196 | SURFOBJ *pso,
|
---|
197 | PATHOBJ *ppo,
|
---|
198 | CLIPOBJ *pco,
|
---|
199 | XFORMOBJ *pxo,
|
---|
200 | BRUSHOBJ *pbo,
|
---|
201 | POINTL *pptlBrushOrg,
|
---|
202 | LINEATTRS *plineattrs,
|
---|
203 | MIX mix
|
---|
204 | )
|
---|
205 | {
|
---|
206 | PPDEV ppdev = (PPDEV)pso->dhpdev;
|
---|
207 |
|
---|
208 | vbvaReportDirtyPath (ppdev, ppo);
|
---|
209 | }
|
---|
210 |
|
---|
211 | void vbvaSaveScreenBits(
|
---|
212 | SURFOBJ *pso,
|
---|
213 | ULONG iMode,
|
---|
214 | ULONG_PTR ident,
|
---|
215 | RECTL *prcl
|
---|
216 | )
|
---|
217 | {
|
---|
218 | PPDEV ppdev = (PPDEV)pso->dhpdev;
|
---|
219 |
|
---|
220 | VBVA_ASSERT(iMode == SS_RESTORE || iMode == SS_SAVE);
|
---|
221 |
|
---|
222 | vbvaReportDirtyRect (ppdev, prcl);
|
---|
223 | }
|
---|
224 |
|
---|