Selaa lähdekoodia

fixed the window maximize/minimize bug on toontown

Asad M. Zaman 22 vuotta sitten
vanhempi
sitoutus
2e85d47cd2

+ 9 - 2
panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx

@@ -4839,8 +4839,15 @@ reset_d3d_device(D3DPRESENT_PARAMETERS *pPresParams, DXScreenData **pScrn) {
 
 
     get_engine()->reset_all_windows(false);// reset old swapchain by releasing
     get_engine()->reset_all_windows(false);// reset old swapchain by releasing
 
 
-    _PresReset.BackBufferWidth = max(_PresReset.BackBufferWidth, pPresParams->BackBufferWidth);
-    _PresReset.BackBufferHeight = max(_PresReset.BackBufferHeight, pPresParams->BackBufferHeight);
+    if (_pScrn->pSwapChain) {  //other windows might be using bigger buffers
+      _PresReset.BackBufferWidth = max(_PresReset.BackBufferWidth, pPresParams->BackBufferWidth);
+      _PresReset.BackBufferHeight = max(_PresReset.BackBufferHeight, pPresParams->BackBufferHeight);
+    }
+    else {  // single window, must reset to the new pPresParams dimension
+      _PresReset.BackBufferWidth = pPresParams->BackBufferWidth;
+      _PresReset.BackBufferHeight = pPresParams->BackBufferHeight;
+    }
+
     hr=_pD3DDevice->Reset(&_PresReset);
     hr=_pD3DDevice->Reset(&_PresReset);
     if (FAILED(hr)) {
     if (FAILED(hr)) {
       return hr;
       return hr;

+ 9 - 2
panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

@@ -4839,8 +4839,15 @@ reset_d3d_device(D3DPRESENT_PARAMETERS *pPresParams, DXScreenData **pScrn) {
 
 
     get_engine()->reset_all_windows(false);// reset old swapchain by releasing
     get_engine()->reset_all_windows(false);// reset old swapchain by releasing
 
 
-    _PresReset.BackBufferWidth = max(_PresReset.BackBufferWidth, pPresParams->BackBufferWidth);
-    _PresReset.BackBufferHeight = max(_PresReset.BackBufferHeight, pPresParams->BackBufferHeight);
+    if (_pScrn->pSwapChain) {  //other windows might be using bigger buffers
+      _PresReset.BackBufferWidth = max(_PresReset.BackBufferWidth, pPresParams->BackBufferWidth);
+      _PresReset.BackBufferHeight = max(_PresReset.BackBufferHeight, pPresParams->BackBufferHeight);
+    }
+    else {  // single window, must reset to the new pPresParams dimension
+      _PresReset.BackBufferWidth = pPresParams->BackBufferWidth;
+      _PresReset.BackBufferHeight = pPresParams->BackBufferHeight;
+    }
+
     hr=_pD3DDevice->Reset(&_PresReset);
     hr=_pD3DDevice->Reset(&_PresReset);
     if (FAILED(hr)) {
     if (FAILED(hr)) {
       return hr;
       return hr;