DXGL r924 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r923‎ | r924 | r925 >
Date:21:53, 11 May 2019
Author:admin
Status:new
Tags:
Comment:
Fix scaled primary modes.
Modified paths:
  • /ddraw/glTexture.cpp (modified) (history)

Diff [purge]

Index: ddraw/glTexture.cpp
@@ -894,6 +894,7 @@
895895 int texformat = -1;
896896 int i;
897897 int bytes;
 898+ int bytes2;
898899 DWORD x, y;
899900 GLenum error;
900901 numtexformats = END_TEXFORMATS - START_TEXFORMATS;
@@ -1678,6 +1679,7 @@
16791680 case MAKEFOURCC('Y', '8', '0', '0'):
16801681 case MAKEFOURCC('G', 'R', 'E', 'Y'):
16811682 bytes = NextMultipleOf4(This->levels[i].ddsd.dwWidth);
 1683+ bytes2 = NextMultipleOf4(This->bigwidth);
16821684 case MAKEFOURCC('Y', '1', '6', ' '):
16831685 case MAKEFOURCC('U', 'Y', 'V', 'Y'):
16841686 case MAKEFOURCC('U', 'Y', 'N', 'V'):
@@ -1689,18 +1691,25 @@
16901692 case MAKEFOURCC('R', 'G', 'B', 'G'):
16911693 case MAKEFOURCC('G', 'R', 'G', 'B'):
16921694 bytes = NextMultipleOf4(2 * This->levels[i].ddsd.dwWidth);
 1695+ bytes2 = NextMultipleOf4(2 * This->bigwidth);
16931696 break;
16941697 case MAKEFOURCC('A', 'Y', 'U', 'V'):
16951698 default:
16961699 bytes = 4 * This->levels[i].ddsd.dwWidth;
 1700+ bytes2 = 4 * This->bigwidth;
16971701 break;
16981702 }
16991703 }
1700 - else bytes = NextMultipleOf4((This->levels[i].ddsd.ddpfPixelFormat.dwRGBBitCount *
1701 - This->levels[i].ddsd.dwWidth) / 8);
 1704+ else
 1705+ {
 1706+ bytes = NextMultipleOf4((This->levels[i].ddsd.ddpfPixelFormat.dwRGBBitCount *
 1707+ This->levels[i].ddsd.dwWidth) / 8);
 1708+ bytes2 = NextMultipleOf4((This->levels[i].ddsd.ddpfPixelFormat.dwRGBBitCount *
 1709+ This->bigwidth) / 8);
 1710+ }
17021711 This->levels[i].buffer = (char*)malloc(bytes * This->levels[i].ddsd.dwHeight);
17031712 if ((i == 0) && ((This->levels[i].ddsd.dwWidth != This->bigwidth) || (This->levels[i].ddsd.dwHeight != This->bigheight)))
1704 - This->levels[i].bigbuffer = (char *)malloc(bytes * This->bigheight);
 1713+ This->levels[i].bigbuffer = (char *)malloc(bytes2 * This->bigheight);
17051714 }
17061715 }
17071716 void glTexture__Destroy(glTexture *This)