Skip to content
Snippets Groups Projects
Commit 00525a29 authored by Ken Martin's avatar Ken Martin
Browse files

Make scene graph apply virtual, win32 setsize/position

Some changes needed for vulkan support
Make Apply() in vtkViewNode virtual
Add SetSize, SetPosition to vtkWin32HardwareWindow
parent 784183be
No related branches found
No related tags found
No related merge requests found
......@@ -237,8 +237,6 @@ void vtkViewNode::Apply(int operation, bool prepass)
case invalidate:
this->Invalidate(prepass);
break;
default:
cerr << "UNKNOWN OPERATION" << operation << endl;
}
}
......
......@@ -143,7 +143,7 @@ protected:
static const char* operation_type_strings[];
void Apply(int operation, bool prepass);
virtual void Apply(int operation, bool prepass);
//@{
/**
......
......@@ -211,3 +211,58 @@ void vtkWin32HardwareWindow::Destroy()
::DestroyWindow(this->WindowId); // windows api
this->WindowId = 0;
}
// ----------------------------------------------------------------------------
void vtkWin32HardwareWindow::SetSize(int x, int y)
{
static bool resizing = false;
if ((this->Size[0] != x) || (this->Size[1] != y))
{
this->Superclass::SetSize(x, y);
if (!this->UseOffScreenBuffers)
{
if (!resizing)
{
resizing = true;
if (this->ParentId)
{
SetWindowExtEx(GetDC(this->WindowId), x, y, nullptr);
SetViewportExtEx(GetDC(this->WindowId), x, y, nullptr);
SetWindowPos(this->WindowId, HWND_TOP, 0, 0, x, y, SWP_NOMOVE | SWP_NOZORDER);
}
else
{
RECT r;
AdjustWindowRectForBorders(this->WindowId, 0, 0, 0, x, y, r);
SetWindowPos(this->WindowId, HWND_TOP, 0, 0, r.right - r.left, r.bottom - r.top,
SWP_NOMOVE | SWP_NOZORDER);
}
resizing = false;
}
}
}
}
void vtkWin32HardwareWindow::SetPosition(int x, int y)
{
static bool resizing = false;
if ((this->Position[0] != x) || (this->Position[1] != y))
{
this->Modified();
this->Position[0] = x;
this->Position[1] = y;
if (this->Mapped)
{
if (!resizing)
{
resizing = true;
SetWindowPos(this->WindowId, HWND_TOP, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
resizing = false;
}
}
}
}
......@@ -51,6 +51,22 @@ public:
void* GetGenericParentId() override;
//@}
//@{
/**
* Set the size of the window in pixels.
*/
void SetSize(int, int) override;
using vtkHardwareWindow::SetSize;
//@}
//@{
/**
* Set the position of the window.
*/
void SetPosition(int, int) override;
using vtkHardwareWindow::SetPosition;
//@}
protected:
vtkWin32HardwareWindow();
~vtkWin32HardwareWindow() override;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment