DXGL r876 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r875‎ | r876 | r877 >
Date:23:35, 21 October 2018
Author:admin
Status:new
Tags:
Comment:
Add destination format to surface format test.
Modified paths:
  • /dxglcfg/surfacegen.cpp (modified) (history)
  • /dxglcfg/tests.cpp (modified) (history)

Diff [purge]

Index: dxglcfg/surfacegen.cpp
@@ -1651,7 +1651,8 @@
16521652 static const LPTSTR StrFormatTestMethods[] =
16531653 {
16541654 _T("Unknown"),
1655 - _T("DDraw Blt"),
 1655+ _T("Blt Vidmem"),
 1656+ _T("Blt Sysmem"),
16561657 _T("D3D Quad"),
16571658 _T("Overlay")
16581659 };
Index: dxglcfg/tests.cpp
@@ -1515,13 +1515,13 @@
15161516 srcformat = 0;
15171517 destformat = -1;
15181518 showhud = 1;
1519 - testpattern = 0;
1520 - testmethod = 0;
 1519+ testpattern = 1;
 1520+ testmethod = 1;
15211521 error = sprites[0].surface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
15221522 DrawPalette(ddsd, (unsigned char*)ddsd.lpSurface);
15231523 error = sprites[0].surface->Unlock(NULL);
15241524 ddsrender->Blt(NULL, sprites[0].surface, NULL, DDBLT_WAIT, NULL);
1525 - DrawFormatTestHUD(ddsrender, 0, -1, 1, 0, 0, ddsd.dwWidth, ddsd.dwHeight, 0, DD_OK);
 1525+ DrawFormatTestHUD(ddsrender, 0, -1, 1, 1, 1, ddsd.dwWidth, ddsd.dwHeight, 0, DD_OK);
15261526 default:
15271527 break;
15281528 }
@@ -2322,13 +2322,13 @@
23232323 ddsd.ddpfPixelFormat = surfaceformats[srcformat];
23242324 }
23252325 error = ddinterface->CreateSurface(&ddsd, &sprites[0].surface, NULL);
2326 - if(error)
 2326+ if (error)
23272327 {
23282328 errorlocation = 1;
23292329 errornumber = error;
23302330 bltfx.dwSize = sizeof(DDBLTFX);
23312331 bltfx.dwFillColor = 0;
2332 - ddsrender->Blt(NULL,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&bltfx);
 2332+ ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
23332333 }
23342334 else
23352335 {
@@ -2348,15 +2348,67 @@
23492349 {
23502350 DrawPalette(ddsd, (unsigned char*)ddsd.lpSurface);
23512351 error = sprites[0].surface->Unlock(NULL);
2352 - // FIXME: Get dest surface type
2353 - error = ddsrender->Blt(NULL, sprites[0].surface, NULL, DDBLT_WAIT, NULL);
2354 - if(error)
 2352+ if (destformat != -1)
23552353 {
2356 - errorlocation = 5;
2357 - errornumber = error;
2358 - bltfx.dwSize = sizeof(DDBLTFX);
2359 - bltfx.dwFillColor = 0;
2360 - ddsrender->Blt(NULL,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&bltfx);
 2354+ ddsrender->GetSurfaceDesc(&ddsd);
 2355+ ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
 2356+ ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
 2357+ if (destformat > 0)
 2358+ {
 2359+ ddsd.dwFlags |= DDSD_PIXELFORMAT;
 2360+ ddsd.ddpfPixelFormat = surfaceformats[destformat];
 2361+ }
 2362+ error = ddinterface->CreateSurface(&ddsd, &sprites[1].surface, NULL);
 2363+ if (error)
 2364+ {
 2365+ errorlocation = 4;
 2366+ errornumber = error;
 2367+ bltfx.dwSize = sizeof(DDBLTFX);
 2368+ bltfx.dwFillColor = 0;
 2369+ ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
 2370+ sprites[0].surface->Release();
 2371+ sprites[0].surface = NULL;
 2372+ }
 2373+ else
 2374+ {
 2375+ error = sprites[1].surface->Blt(NULL, sprites[0].surface, NULL, DDBLT_WAIT, NULL);
 2376+ if (error)
 2377+ {
 2378+ errorlocation = 6;
 2379+ errornumber = error;
 2380+ bltfx.dwSize = sizeof(DDBLTFX);
 2381+ bltfx.dwFillColor = 0;
 2382+ ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
 2383+ }
 2384+ else
 2385+ {
 2386+ error = ddsrender->Blt(NULL, sprites[1].surface, NULL, DDBLT_WAIT, NULL);
 2387+ if (error)
 2388+ {
 2389+ errorlocation = 7;
 2390+ errornumber = error;
 2391+ bltfx.dwSize = sizeof(DDBLTFX);
 2392+ bltfx.dwFillColor = 0;
 2393+ ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
 2394+ }
 2395+ }
 2396+ sprites[0].surface->Release();
 2397+ sprites[0].surface = NULL;
 2398+ sprites[1].surface->Release();
 2399+ sprites[1].surface = NULL;
 2400+ }
 2401+ }
 2402+ else
 2403+ {
 2404+ error = ddsrender->Blt(NULL, sprites[0].surface, NULL, DDBLT_WAIT, NULL);
 2405+ if (error)
 2406+ {
 2407+ errorlocation = 5;
 2408+ errornumber = error;
 2409+ bltfx.dwSize = sizeof(DDBLTFX);
 2410+ bltfx.dwFillColor = 0;
 2411+ ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
 2412+ }
23612413 sprites[0].surface->Release();
23622414 sprites[0].surface = NULL;
23632415 }