DDraw Clipper fix
Lionel Ulmer
lionel.ulmer at free.fr
Sat Aug 3 07:05:54 CDT 2002
Hi all,
This should hopefully fix bug :
Bug 936 - Incorrect placement of DirectDraw output (offset outside the Windows 'window')
Basically, the logic to compute the clipping window was wrong (or at least I
did not understand all the subtilities of the code :-) ). At least with this
fix, this particular application now runs fine.
Changelog:
Fix the clipping window computation when blitting on the screen in non-full
screen DDraw case.
--
Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
Index: dlls/ddraw/dsurface/user.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/dsurface/user.c,v
retrieving revision 1.11
diff -u -r1.11 user.c
--- dlls/ddraw/dsurface/user.c 28 Jun 2002 23:26:57 -0000 1.11
+++ dlls/ddraw/dsurface/user.c 3 Aug 2002 11:59:13 -0000
@@ -522,17 +522,17 @@
if (This->clipper) {
RECT xrc;
HWND hwnd = This->clipper->hWnd;
- if (hwnd && GetWindowRect(hwnd,&xrc)) {
- /* Do not forget to honor the offset within the clip window. */
- /* translate the surface to 0.0 of the clip window */
- OffsetRect(&drawrect,offset.x,offset.y);
+
+ if (hwnd && GetClientRect(hwnd,&xrc)) {
+ /* Do the intersection between the clipper window and the DDraw window */
+ OffsetRect(&xrc, offset.x, offset.y);
IntersectRect(&drawrect,&drawrect,&xrc);
- /* translate it back to its original position */
- OffsetRect(&drawrect,-offset.x,-offset.y);
}
}
- if (rc)
+ if (rc) {
+ /* Now intersect the DDraw 'window' and the requested part to draw */
IntersectRect(&drawrect,&drawrect,rc);
+ }
else {
/* Only use this if the caller did not pass a rectangle, since
* due to double locking this could be the wrong one ... */
@@ -540,7 +540,7 @@
IntersectRect(&drawrect,&drawrect,&This->lastlockrect);
}
BitBlt(hDisplayDC,
- drawrect.left+offset.x, drawrect.top+offset.y,
+ drawrect.left-offset.x, drawrect.top-offset.y,
drawrect.right-drawrect.left, drawrect.bottom-drawrect.top,
hSurfaceDC,
drawrect.left, drawrect.top,
More information about the wine-patches
mailing list