DXGL r896 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r895‎ | r896 | r897 >
Date:19:57, 8 March 2019
Author:admin
Status:new
Tags:
Comment:
Fix Blt to primary in window mode when multi-monitor origin is not at 0,0
Modified paths:
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)
  • /ddraw/glRenderer.cpp (modified) (history)
  • /ddraw/glRenderer.h (modified) (history)

Diff [purge]

Index: ddraw/glDirectDrawSurface.cpp
@@ -192,6 +192,8 @@
193193 {
194194 fakex = ddsd.dwWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
195195 fakey = ddsd.dwHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
 196+ ddInterface->renderer->xoffset = GetSystemMetrics(SM_XVIRTUALSCREEN);
 197+ ddInterface->renderer->yoffset = GetSystemMetrics(SM_YVIRTUALSCREEN);
196198 }
197199 else
198200 {
@@ -758,9 +760,9 @@
759761 {
760762 HRESULT error;
761763 RECT tmprect;
762 - glDirectDrawSurface7 *pattern;
 764+ glDirectDrawSurface7* pattern;
763765 BltCommand cmd;
764 - TRACE_ENTER(6,14,this,26,lpDestRect,14,lpDDSrcSurface,26,lpSrcRect,9,dwFlags,14,lpDDBltFx);
 766+ TRACE_ENTER(6, 14, this, 26, lpDestRect, 14, lpDDSrcSurface, 26, lpSrcRect, 9, dwFlags, 14, lpDDBltFx);
765767 if (!this) TRACE_RET(HRESULT, 23, DDERR_INVALIDOBJECT);
766768 if ((dwFlags & DDBLT_DEPTHFILL) && !lpDDBltFx) TRACE_RET(HRESULT, 32, DDERR_INVALIDPARAMS);
767769 if ((dwFlags & DDBLT_COLORFILL) && !lpDDBltFx) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
@@ -768,7 +770,12 @@
769771 ZeroMemory(&cmd, sizeof(BltCommand));
770772 cmd.dest = this->texture;
771773 cmd.destlevel = this->miplevel;
772 - if (lpDestRect) cmd.destrect = *lpDestRect;
 774+ if (lpDestRect)
 775+ {
 776+ cmd.destrect = *lpDestRect;
 777+ if(!ddInterface->GetFullscreen() && (ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
 778+ OffsetRect(&cmd.destrect, 0 - ddInterface->renderer->xoffset, 0 - ddInterface->renderer->yoffset);
 779+ }
773780 else cmd.destrect = nullrect;
774781 if (lpSrcRect) cmd.srcrect = *lpSrcRect;
775782 else cmd.srcrect = nullrect;
Index: ddraw/glRenderer.cpp
@@ -3992,6 +3992,7 @@
39933993 viewport[3] = viewrect->bottom;
39943994 ClientToScreen(This->RenderWnd->GetHWnd(),(LPPOINT)&viewrect->left);
39953995 ClientToScreen(This->RenderWnd->GetHWnd(),(LPPOINT)&viewrect->right);
 3996+ OffsetRect(viewrect, 0 - This->xoffset, 0 - This->yoffset);
39963997 view[0] = (GLfloat)viewrect->left;
39973998 view[1] = (GLfloat)viewrect->right;
39983999 view[2] = (GLfloat)texture->bigheight-(GLfloat)viewrect->top;
Index: ddraw/glRenderer.h
@@ -160,6 +160,7 @@
161161 GLsizei fvf_stride;
162162 BOOL mode_3d;
163163 float postsizex, postsizey;
 164+ int xoffset, yoffset;
164165 } glRenderer;
165166
166167 HRESULT glRenderer_AddCommand(glRenderer *This, QueueCmd *cmd, BOOL inner, BOOL wait);