Index: ddraw/glRenderer.cpp |
— | — | @@ -1094,6 +1094,48 @@ |
1095 | 1095 | vertices[3].t = t2;
|
1096 | 1096 | }
|
1097 | 1097 |
|
| 1098 | +void RotateBlt90(BltVertex *vertices, int times)
|
| 1099 | +{
|
| 1100 | + GLfloat s0, s1, s2, s3;
|
| 1101 | + GLfloat t0, t1, t2, t3;
|
| 1102 | + switch (times)
|
| 1103 | + {
|
| 1104 | + case 0:
|
| 1105 | + default:
|
| 1106 | + return;
|
| 1107 | + case 1:
|
| 1108 | + s0 = vertices[0].s; t0 = vertices[0].t;
|
| 1109 | + s1 = vertices[1].s; t1 = vertices[1].t;
|
| 1110 | + s2 = vertices[2].s; t2 = vertices[2].t;
|
| 1111 | + s3 = vertices[3].s; t3 = vertices[3].t;
|
| 1112 | + vertices[0].s = s1; vertices[0].t = t1;
|
| 1113 | + vertices[1].s = s3; vertices[1].t = t3;
|
| 1114 | + vertices[2].s = s0; vertices[2].t = t0;
|
| 1115 | + vertices[3].s = s2; vertices[3].t = t2;
|
| 1116 | + break;
|
| 1117 | + case 2:
|
| 1118 | + s0 = vertices[0].s; t0 = vertices[0].t;
|
| 1119 | + s1 = vertices[1].s; t1 = vertices[1].t;
|
| 1120 | + s2 = vertices[2].s; t2 = vertices[2].t;
|
| 1121 | + s3 = vertices[3].s; t3 = vertices[3].t;
|
| 1122 | + vertices[0].s = s3; vertices[0].t = t3;
|
| 1123 | + vertices[1].s = s2; vertices[1].t = t2;
|
| 1124 | + vertices[2].s = s1; vertices[2].t = t1;
|
| 1125 | + vertices[3].s = s0; vertices[3].t = t0;
|
| 1126 | + break;
|
| 1127 | + case 3:
|
| 1128 | + s0 = vertices[0].s; t0 = vertices[0].t;
|
| 1129 | + s1 = vertices[1].s; t1 = vertices[1].t;
|
| 1130 | + s2 = vertices[2].s; t2 = vertices[2].t;
|
| 1131 | + s3 = vertices[3].s; t3 = vertices[3].t;
|
| 1132 | + vertices[0].s = s2; vertices[0].t = t2;
|
| 1133 | + vertices[1].s = s0; vertices[1].t = t0;
|
| 1134 | + vertices[2].s = s3; vertices[2].t = t3;
|
| 1135 | + vertices[3].s = s1; vertices[3].t = t1;
|
| 1136 | + break;
|
| 1137 | + }
|
| 1138 | +}
|
| 1139 | +
|
1098 | 1140 | void glRenderer__Blt(glRenderer *This, LPRECT lpDestRect, glDirectDrawSurface7 *src,
|
1099 | 1141 | glDirectDrawSurface7 *dest, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
|
1100 | 1142 | {
|
— | — | @@ -1178,6 +1220,7 @@ |
1179 | 1221 | rotates &= 3;
|
1180 | 1222 | if (rotates)
|
1181 | 1223 | {
|
| 1224 | + RotateBlt90(This->bltvertices, rotates);
|
1182 | 1225 | }
|
1183 | 1226 | }
|
1184 | 1227 | if (dwFlags & 0x10000000)
|
Index: dxgltest/Tests2D.cpp |
— | — | @@ -629,7 +629,7 @@ |
630 | 630 | ddsrender->GetSurfaceDesc(&ddsd);
|
631 | 631 | ddsrender->GetPalette(&palette);
|
632 | 632 | sprites[0].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
633 | | - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
| 633 | + sprites[0].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
634 | 634 | if (ddver > 3) sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
635 | 635 | else sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC);
|
636 | 636 | memcpy(&sprites[1], &sprites[0], sizeof(DDSPRITE));
|
— | — | @@ -665,6 +665,18 @@ |
666 | 666 | ddcaps.dwSize = sizeof(DDCAPS);
|
667 | 667 | ddinterface->GetCaps(&ddcaps, NULL);
|
668 | 668 | DrawROPPatterns(ddsrender, sprites, backbuffers, ddver, bpp, ddcaps.dwRops,hWnd,palette);
|
| 669 | + break;
|
| 670 | + case 8:
|
| 671 | + ddsrender->GetSurfaceDesc(&ddsd);
|
| 672 | + sprites[0].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
| 673 | + sprites[0].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
| 674 | + if (ddver > 3) sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 675 | + else sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 676 | + sprites[0].ddsd.dwWidth = sprites[0].ddsd.dwHeight =
|
| 677 | + sprites[0].rect.right = sprites[0].rect.bottom = 64;
|
| 678 | + ddinterface->CreateSurface(&sprites[0].ddsd, &sprites[0].surface, NULL);
|
| 679 | + DrawRotatedBlt(ddsrender, sprites);
|
| 680 | + break;
|
669 | 681 | }
|
670 | 682 | }
|
671 | 683 |
|
Index: dxgltest/dxgltest.cpp |
— | — | @@ -226,7 +226,8 @@ |
227 | 227 | {1, 7, 0, 1, true, 60.0, false, false, _T("BltFast background and sprites")},
|
228 | 228 | {1, 7, 0, 0, false, 0.0, false, false, _T("Random color fill Blt() paterns")},
|
229 | 229 | {1, 7, 0, 0, false, 0.0, false, false, _T("Mouse pointer event test")},
|
230 | | - {1, 7, 1, 1, true, 1.0, false, false, _T("Raster Operation Blt() test")}
|
| 230 | + {1, 7, 1, 1, true, 1.0, false, false, _T("Raster Operation Blt() test")},
|
| 231 | + {1, 7, 0, 0, false, 0.0, false, false, _T("Mirrored and Rotated Blt() test")}
|
231 | 232 | };
|
232 | 233 | const int END_2D = __LINE__ - 4;
|
233 | 234 | const int numtests2d = END_2D - START_2D;
|
— | — | @@ -383,7 +384,9 @@ |
384 | 385 | case IDC_TEST:
|
385 | 386 | if(SendDlgItemMessage(hWnd,IDC_RESIZABLE,BM_GETCHECK,0,0)) resizable2d = true;
|
386 | 387 | else resizable2d = false;
|
387 | | - i = SendDlgItemMessage(hWnd,IDC_VIDMODES,LB_GETCURSEL,0,0);
|
| 388 | + if (buffer2d < minbuffer2d) buffer2d = minbuffer2d;
|
| 389 | + if (buffer2d > maxbuffer2d) buffer2d = maxbuffer2d;
|
| 390 | + i = SendDlgItemMessage(hWnd, IDC_VIDMODES, LB_GETCURSEL, 0, 0);
|
388 | 391 | SendDlgItemMessage(hWnd,IDC_VIDMODES,LB_GETTEXT,i,(LPARAM)tmpstring);
|
389 | 392 | TranslateResolutionString(tmpstring,width,height,bpp,refresh);
|
390 | 393 | RunTest2D(currenttest2d,width,height,bpp,refresh,buffer2d,api2d,framerate2d,fullscreen2d,resizable2d);
|
Index: dxgltest/surfacegen.cpp |
— | — | @@ -1121,4 +1121,87 @@ |
1122 | 1122 | back->Release();
|
1123 | 1123 | }
|
1124 | 1124 | free(bmi);
|
| 1125 | +}
|
| 1126 | +
|
| 1127 | +void DrawRotatedBlt(MultiDirectDrawSurface *primary, DDSPRITE *sprites)
|
| 1128 | +{
|
| 1129 | + HDC hdc;
|
| 1130 | + DDBLTFX bltfx;
|
| 1131 | + ZeroMemory(&bltfx, sizeof(DDBLTFX));
|
| 1132 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 1133 | + sprites[0].surface->GetDC(&hdc);
|
| 1134 | + DrawBitmap(hdc, 0, 0, 64, 64, MAKEINTRESOURCE(IDB_DXGLINV64), SRCCOPY);
|
| 1135 | + sprites[0].surface->ReleaseDC(hdc);
|
| 1136 | + RECT r;
|
| 1137 | + r.left = 0;
|
| 1138 | + r.right = 64;
|
| 1139 | + r.top = 0;
|
| 1140 | + r.bottom = 64;
|
| 1141 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1142 | + r.left = 64;
|
| 1143 | + r.right = 128;
|
| 1144 | + bltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT;
|
| 1145 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1146 | + r.left = 128;
|
| 1147 | + r.right = 192;
|
| 1148 | + bltfx.dwDDFX = DDBLTFX_MIRRORUPDOWN;
|
| 1149 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1150 | + r.left = 192;
|
| 1151 | + r.right = 256;
|
| 1152 | + bltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
|
| 1153 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1154 | + r.top = 64;
|
| 1155 | + r.bottom = 128;
|
| 1156 | + r.left = 0;
|
| 1157 | + r.right = 64;
|
| 1158 | + bltfx.dwDDFX = DDBLTFX_ROTATE90;
|
| 1159 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1160 | + r.left = 64;
|
| 1161 | + r.right = 128;
|
| 1162 | + bltfx.dwDDFX = DDBLTFX_ROTATE90 | DDBLTFX_MIRRORLEFTRIGHT;
|
| 1163 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1164 | + r.left = 128;
|
| 1165 | + r.right = 192;
|
| 1166 | + bltfx.dwDDFX = DDBLTFX_ROTATE90 | DDBLTFX_MIRRORUPDOWN;
|
| 1167 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1168 | + r.left = 192;
|
| 1169 | + r.right = 256;
|
| 1170 | + bltfx.dwDDFX = DDBLTFX_ROTATE90 | DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
|
| 1171 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1172 | + r.top = 128;
|
| 1173 | + r.bottom = 192;
|
| 1174 | + r.left = 0;
|
| 1175 | + r.right = 64;
|
| 1176 | + bltfx.dwDDFX = DDBLTFX_ROTATE180;
|
| 1177 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1178 | + r.left = 64;
|
| 1179 | + r.right = 128;
|
| 1180 | + bltfx.dwDDFX = DDBLTFX_ROTATE180 | DDBLTFX_MIRRORLEFTRIGHT;
|
| 1181 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1182 | + r.left = 128;
|
| 1183 | + r.right = 192;
|
| 1184 | + bltfx.dwDDFX = DDBLTFX_ROTATE180 | DDBLTFX_MIRRORUPDOWN;
|
| 1185 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1186 | + r.left = 192;
|
| 1187 | + r.right = 256;
|
| 1188 | + bltfx.dwDDFX = DDBLTFX_ROTATE180 | DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
|
| 1189 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1190 | + r.top = 192;
|
| 1191 | + r.bottom = 256;
|
| 1192 | + r.left = 0;
|
| 1193 | + r.right = 64;
|
| 1194 | + bltfx.dwDDFX = DDBLTFX_ROTATE270;
|
| 1195 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1196 | + r.left = 64;
|
| 1197 | + r.right = 128;
|
| 1198 | + bltfx.dwDDFX = DDBLTFX_ROTATE270 | DDBLTFX_MIRRORLEFTRIGHT;
|
| 1199 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1200 | + r.left = 128;
|
| 1201 | + r.right = 192;
|
| 1202 | + bltfx.dwDDFX = DDBLTFX_ROTATE270 | DDBLTFX_MIRRORUPDOWN;
|
| 1203 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1204 | + r.left = 192;
|
| 1205 | + r.right = 256;
|
| 1206 | + bltfx.dwDDFX = DDBLTFX_ROTATE270 | DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
|
| 1207 | + primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1125 | 1208 | } |
\ No newline at end of file |
Index: dxgltest/surfacegen.h |
— | — | @@ -24,5 +24,6 @@ |
25 | 25 | void DrawGDIPatterns(DDSURFACEDESC2 ddsd, HDC hDC, int type); // GDI pattern test
|
26 | 26 | void DrawROPPatterns(MultiDirectDrawSurface *primary, DDSPRITE *sprites, int backbuffers, int ddver, int bpp, DWORD *ropcaps,
|
27 | 27 | HWND hwnd, LPDIRECTDRAWPALETTE palette); // ROP pattern test
|
| 28 | +void DrawRotatedBlt(MultiDirectDrawSurface *primary, DDSPRITE *sprites);
|
28 | 29 |
|
29 | 30 | #endif //_SURFACEGEN_H |
\ No newline at end of file |