bool SurfaceD3D::checkForOutOfDateSwapChain() { RECT client; int clientWidth = getWidth(); int clientHeight = getHeight(); bool sizeDirty = false; if (!mFixedSize && !mNativeWindow.isIconic()) { // The window is automatically resized to 150x22 when it's minimized, but the swapchain shouldn't be resized // because that's not a useful size to render to. if (!mNativeWindow.getClientRect(&client)) { ASSERT(false); return false; } // Grow the buffer now, if the window has grown. We need to grow now to avoid losing information. clientWidth = client.right - client.left; clientHeight = client.bottom - client.top; sizeDirty = clientWidth != getWidth() || clientHeight != getHeight(); } bool wasDirty = (mSwapIntervalDirty || sizeDirty); if (mSwapIntervalDirty) { resetSwapChain(clientWidth, clientHeight); } else if (sizeDirty) { resizeSwapChain(clientWidth, clientHeight); } return wasDirty; }
// virtual void QD3D10Widget::resizeEvent( QResizeEvent* e ) { // resize swap chain and back buffer QSize size = e->size(); int width = size.width(); int height = size.height(); // set render targets to null m_pDevice->OMSetRenderTargets( 0, NULL, NULL ); // release the old render target view and make a new one m_pBackBufferRenderTargetView->Release(); m_pBackBuffer->Release(); // resize the swap chain resizeSwapChain( width, height ); // recreate the render targets createBackBufferRenderTargetView(); // resize depth stencil buffer resizeDepthStencilBuffer( width, height ); // point device at new back buffers restoreBackBuffer(); // resize viewport D3D10_VIEWPORT viewport = D3D10Utils::createViewport( width, height ); m_pDevice->RSSetViewports( 1, &viewport ); resizeD3D(width, height); }
bool Surface::checkForOutOfDateSwapChain() { RECT client; int clientWidth = getWidth(); int clientHeight = getHeight(); bool sizeDirty = false; if (!mFixedSize && !mNativeWindow.isIconic()) { // The window is automatically resized to 150x22 when it's minimized, but the swapchain shouldn't be resized // because that's not a useful size to render to. if (!mNativeWindow.getClientRect(&client)) { ASSERT(false); return false; } // Grow the buffer now, if the window has grown. We need to grow now to avoid losing information. clientWidth = client.right - client.left; clientHeight = client.bottom - client.top; sizeDirty = clientWidth != getWidth() || clientHeight != getHeight(); } if (mFixedSize && (mWidth != mFixedWidth || mHeight != mFixedHeight)) { clientWidth = mFixedWidth; clientHeight = mFixedHeight; sizeDirty = true; } bool wasDirty = (mSwapIntervalDirty || sizeDirty); if (mSwapIntervalDirty) { resetSwapChain(clientWidth, clientHeight); } else if (sizeDirty) { resizeSwapChain(clientWidth, clientHeight); } if (wasDirty) { if (static_cast<egl::Surface*>(getCurrentDrawSurface()) == this) { glMakeCurrent(glGetCurrentContext(), static_cast<egl::Display*>(getCurrentDisplay()), this); } return true; } return false; }
bool Surface::checkForOutOfDateSwapChain() { #if defined(ANGLE_PLATFORM_WINRT) int clientWidth = 0; int clientHeight = 0; winrt::getCurrentWindowDimensions(clientWidth,clientHeight); #else RECT client; if (!GetClientRect(getWindowHandle(), &client)) { ASSERT(false); return false; } // Grow the buffer now, if the window has grown. We need to grow now to avoid losing information. int clientWidth = client.right - client.left; int clientHeight = client.bottom - client.top; #endif // #if defined(ANGLE_PLATFORM_WINRT) bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight(); if (mSwapIntervalDirty) { resetSwapChain(clientWidth, clientHeight); } else if (sizeDirty) { resizeSwapChain(clientWidth, clientHeight); } if (mSwapIntervalDirty || sizeDirty) { if (static_cast<egl::Surface*>(getCurrentDrawSurface()) == this) { glMakeCurrent(glGetCurrentContext(), static_cast<egl::Display*>(getCurrentDisplay()), this); } return true; } return false; }