DXGL r417 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r416
|
r417
|
r418
>
Date:
01:32, 3 April 2014
Author:
admin
Status:
new
Tags:
Comment:
Custom aspect calculation for scaling mode 1.
Modified paths:
/ddraw/glDirectDraw.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/glDirectDraw.cpp
—
—
@@ -1409,23 +1409,40 @@
1410
1410
TRACE_EXIT(23,DD_OK);
1411
1411
return DD_OK;
1412
1412
break;
1413
- case 2: // Scale to screen
1413
+ case 2: // Scale to screen, aspect corrected
1414
1414
primaryx = dwWidth;
1415
1415
screenx = currmode.dmPelsWidth;
1416
1416
primaryy = dwHeight;
1417
1417
screeny = currmode.dmPelsHeight;
1418
- aspect = (float)dwWidth / (float)dwHeight;
1419
- xmul = (float)screenx / (float)dwWidth;
1420
- ymul = (float)screeny / (float)dwHeight;
1421
- if((float)dwWidth*(float)ymul > (float)screenx)
1418
+ if (_isnan(dxglcfg.aspect) || dxglcfg.aspect <= 0)
1422
1419
{
1423
- internalx = (DWORD)((float)dwWidth * (float)xmul);
1424
- internaly = (DWORD)((float)dwHeight * (float)xmul);
1420
+ aspect = (float)dwWidth / (float)dwHeight;
1421
+ xmul = (float)screenx / (float)dwWidth;
1422
+ ymul = (float)screeny / (float)dwHeight;
1423
+ if ((float)dwWidth*(float)ymul > (float)screenx)
1424
+ {
1425
+ internalx = (DWORD)((float)dwWidth * (float)xmul);
1426
+ internaly = (DWORD)((float)dwHeight * (float)xmul);
1427
+ }
1428
+ else
1429
+ {
1430
+ internalx = (DWORD)((float)dwWidth * (float)ymul);
1431
+ internaly = (DWORD)((float)dwHeight * (float)ymul);
1432
+ }
1425
1433
}
1426
1434
else
1427
1435
{
1428
- internalx = (DWORD)((float)dwWidth * (float)ymul);
1429
- internaly = (DWORD)((float)dwHeight * (float)ymul);
1436
+ aspect = dxglcfg.aspect;
1437
+ if (screenx*aspect > screeny)
1438
+ {
1439
+ internalx = (DWORD)((float)screeny / (float)aspect);
1440
+ internaly = screeny;
1441
+ }
1442
+ else
1443
+ {
1444
+ internalx = screenx;
1445
+ internaly = (DWORD)((float)screenx * (float)aspect);
1446
+ }
1430
1447
}
1431
1448
if(dxglcfg.colormode) internalbpp = screenbpp = dwBPP;
1432
1449
else internalbpp = screenbpp = currmode.dmBitsPerPel;
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version