DXGL r485 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r484‎ | r485 | r486 >
Date:00:22, 12 August 2014
Author:admin
Status:new
Tags:
Comment:
Support Mirrored Blt.
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glRenderer.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -955,7 +955,8 @@
956956 ddCaps.dwCaps2 = DDCAPS2_CANRENDERWINDOWED | DDCAPS2_WIDESURFACES | DDCAPS2_NOPAGELOCKREQUIRED |
957957 DDCAPS2_FLIPINTERVAL | DDCAPS2_FLIPNOVSYNC | DDCAPS2_NONLOCALVIDMEM;
958958 ddCaps.dwFXCaps = DDFXCAPS_BLTSHRINKX | DDFXCAPS_BLTSHRINKY |
959 - DDFXCAPS_BLTSTRETCHX | DDFXCAPS_BLTSTRETCHY;
 959+ DDFXCAPS_BLTSTRETCHX | DDFXCAPS_BLTSTRETCHY | DDFXCAPS_BLTMIRRORLEFTRIGHT |
 960+ DDFXCAPS_BLTMIRRORUPDOWN;
960961 ddCaps.dwPalCaps = DDPCAPS_8BIT | DDPCAPS_PRIMARYSURFACE;
961962 ddCaps.ddsOldCaps.dwCaps = ddCaps.ddsCaps.dwCaps = DDSCAPS_3DDEVICE |
962963 DDSCAPS_BACKBUFFER | DDSCAPS_COMPLEX | DDSCAPS_FLIP |
Index: ddraw/glRenderer.cpp
@@ -1071,9 +1071,33 @@
10721072 break;
10731073 }
10741074 }
 1075+
 1076+void BltFlipLR(BltVertex *vertices)
 1077+{
 1078+ GLfloat s1, s2;
 1079+ s1 = vertices[0].s;
 1080+ s2 = vertices[2].s;
 1081+ vertices[0].s = vertices[1].s;
 1082+ vertices[2].s = vertices[3].s;
 1083+ vertices[1].s = s1;
 1084+ vertices[3].s = s2;
 1085+}
 1086+
 1087+void BltFlipUD(BltVertex *vertices)
 1088+{
 1089+ GLfloat t1, t2;
 1090+ t1 = vertices[0].t;
 1091+ t2 = vertices[1].t;
 1092+ vertices[0].t = vertices[2].t;
 1093+ vertices[1].t = vertices[3].t;
 1094+ vertices[2].t = t1;
 1095+ vertices[3].t = t2;
 1096+}
 1097+
10751098 void glRenderer__Blt(glRenderer *This, LPRECT lpDestRect, glDirectDrawSurface7 *src,
10761099 glDirectDrawSurface7 *dest, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
10771100 {
 1101+ int rotates = 0;
10781102 BOOL usedest = FALSE;
10791103 BOOL usepattern = FALSE;
10801104 LONG sizes[6];
@@ -1142,7 +1166,21 @@
11431167 This->bltvertices[0].s = This->bltvertices[2].s = (GLfloat)srcrect.right / (GLfloat)ddsdSrc.dwWidth;
11441168 This->bltvertices[0].t = This->bltvertices[1].t = (GLfloat)srcrect.top / (GLfloat)ddsdSrc.dwHeight;
11451169 This->bltvertices[2].t = This->bltvertices[3].t = (GLfloat)srcrect.bottom / (GLfloat)ddsdSrc.dwHeight;
1146 - if(dwFlags & 0x10000000)
 1170+ if ((lpDDBltFx) && (dwFlags & DDBLT_DDFX))
 1171+ {
 1172+ if (lpDDBltFx->dwDDFX & DDBLTFX_MIRRORLEFTRIGHT)
 1173+ BltFlipLR(This->bltvertices);
 1174+ if (lpDDBltFx->dwDDFX & DDBLTFX_MIRRORUPDOWN)
 1175+ BltFlipUD(This->bltvertices);
 1176+ if (lpDDBltFx->dwDDFX & DDBLTFX_ROTATE90) rotates++;
 1177+ if (lpDDBltFx->dwDDFX & DDBLTFX_ROTATE180) rotates += 2;
 1178+ if (lpDDBltFx->dwDDFX & DDBLTFX_ROTATE270) rotates += 3;
 1179+ rotates &= 3;
 1180+ if (rotates)
 1181+ {
 1182+ }
 1183+ }
 1184+ if (dwFlags & 0x10000000)
11471185 {
11481186 This->bltvertices[1].stencils = This->bltvertices[3].stencils = This->bltvertices[1].x / (GLfloat)dest->fakex;
11491187 This->bltvertices[0].stencils = This->bltvertices[2].stencils = This->bltvertices[0].x / (GLfloat)dest->fakex;