DXGL r620 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r619‎ | r620 | r621 >
Date:20:37, 27 September 2015
Author:admin
Status:new
Tags:
Comment:
Fix resizing 8-bit backbuffer.
Modified paths:
  • /ddraw/glRenderer.cpp (modified) (history)
  • /ddraw/glTexture.cpp (modified) (history)

Diff [purge]

Index: ddraw/glRenderer.cpp
@@ -1744,6 +1744,7 @@
17451745 {
17461746 DDSURFACEDESC2 ddsd = ddsdBackbuffer;
17471747 GLfloat view[4];
 1748+ DDSURFACEDESC2 tmpddsd;
17481749 glUtil_SetActiveTexture(This->util,0);
17491750 if(!This->backbuffer)
17501751 {
@@ -1755,7 +1756,12 @@
17561757 }
17571758 if((This->backx != x) || (This->backy != y))
17581759 {
1759 - glTexture__Upload(This->backbuffer, 0, FALSE, TRUE);
 1760+ tmpddsd = This->backbuffer->ddsd;
 1761+ tmpddsd.dwSize = sizeof(DDSURFACEDESC2);
 1762+ tmpddsd.dwFlags = DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT;
 1763+ tmpddsd.dwWidth = x;
 1764+ tmpddsd.dwHeight = y;
 1765+ glTexture__Modify(This->backbuffer, &tmpddsd, x, y, FALSE);
17601766 This->backx = x;
17611767 This->backy = y;
17621768 }
@@ -2633,6 +2639,7 @@
26342640 (cmd->dest->ddsd.dwHeight != cmd->dest->dummycolor->ddsd.dwHeight))
26352641 {
26362642 tmpddsd = cmd->dest->ddsd;
 2643+ tmpddsd.dwSize = sizeof(DDSURFACEDESC2);
26372644 tmpddsd.dwFlags = DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT;
26382645 tmpddsd.dwWidth = cmd->dest->ddsd.dwWidth;
26392646 tmpddsd.dwHeight = cmd->dest->ddsd.dwHeight;
Index: ddraw/glTexture.cpp
@@ -598,11 +598,12 @@
599599 if (!(ddsd->dwFlags & DDSD_PITCH))
600600 {
601601 if (ddsd->dwFlags & DDSD_PIXELFORMAT)
602 - texture->ddsd.lPitch = NextMultipleOf4(ddsd->dwWidth *
 602+ texture->ddsd.lPitch = texture->mipmaps[0].pitch = NextMultipleOf4(ddsd->dwWidth *
603603 (NextMultipleOf8(ddsd->ddpfPixelFormat.dwRGBBitCount) / 8));
604 - else texture->ddsd.lPitch = NextMultipleOf4(ddsd->dwWidth *
 604+ else texture->ddsd.lPitch = texture->mipmaps[0].pitch = NextMultipleOf4(ddsd->dwWidth *
605605 (NextMultipleOf8(texture->ddsd.ddpfPixelFormat.dwRGBBitCount) / 8));
606606 }
 607+ if(bigx) texture->mipmaps[0].bigx = bigx;
607608 resize = TRUE;
608609 }
609610 }
@@ -619,6 +620,7 @@
620621 if (ddsd->dwHeight != texture->ddsd.dwHeight)
621622 {
622623 texture->ddsd.dwHeight = texture->mipmaps[0].height = ddsd->dwHeight;
 624+ if (bigy) texture->mipmaps[0].bigy = bigy;
623625 resize = TRUE;
624626 }
625627 }