Commit e67f40b1 authored by Max Smolens's avatar Max Smolens
Browse files

vtkWin32OpenGLRenderWindow: fix GetScreenSize() while rendering offscreen

This commit fixes a problem where calling GetScreenSize() while rendering
offscreen changes the stored size of the render window (i.e. this->Size). This
resulted in the offscreen render being the wrong size.
parent f5c800d2
......@@ -72,6 +72,25 @@ int TestWin32OpenGLRenderWindow(int argc, char* argv[])
// Render offscreen at a larger size
renWin->SetOffScreenRendering(1);
renWin->SetSize(scaledWidth, scaledHeight);
int* screenSize = renWin->GetScreenSize();
if (screenSize[0] != scaledWidth || screenSize[1] != scaledHeight)
{
std::cout << "Expected calling vtkWin32OpenGLRenderWindow::GetScreenSize()"
" not to change render window size"
<< std::endl;
return EXIT_FAILURE;
}
int* windowSize = renWin->GetSize();
if (windowSize[0] != scaledWidth || windowSize[1] != scaledHeight)
{
std::cout << "Expected calling vtkWin32OpenGLRenderWindow::GetScreenSize()"
" not to change render window size"
<< std::endl;
return EXIT_FAILURE;
}
renWin->Render();
int retVal = vtkRegressionTestImage(renWin.GetPointer());
......
......@@ -1195,6 +1195,11 @@ int *vtkWin32OpenGLRenderWindow::GetSize(void)
// Get the size of the whole screen.
int *vtkWin32OpenGLRenderWindow::GetScreenSize(void)
{
if (this->OffScreenRendering)
{
return this->Size;
}
HDC hDC = ::GetDC(NULL);
if (hDC)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment