Bug in vtkViewport (version 3.1)
Jorrit Schaap
jorrit at lkeb.azl.nl
Thu Mar 16 03:37:41 EST 2000
Hi all,
I have a report of a minor bug in the vtkViewport class.
If I ask a vtkRenderer for its size, it crashes if it has never been
rendered.
This is due to the folowing piece of code:
in vtkViewport.cxx function GetSize()
// Return the size of the viewport in display coordinates.
int *vtkViewport::GetSize()
{
// Get the window size
int* winSize = this->VTKWindow->GetSize();
// Calculate a width and height for the viewport
float vptWidth = this->Viewport[2] - this->Viewport[0];
float vptHeight = this->Viewport[3] - this->Viewport[1];
// Round the size up
this->Size[0] = (int) (vptWidth * (float) winSize[0] + 0.5);
this->Size[1] = (int) (vptHeight * (float) winSize[1] + 0.5);
return this->Size;
}
If this->VTKWindow doesn't exist, then it crashes, so in my opinion the
function should yield:
// Return the size of the viewport in display coordinates.
int *vtkViewport::GetSize()
{
if(this->VTKWindow)
{
// Get the window size
int* winSize = this->VTKWindow->GetSize();
// Calculate a width and height for the viewport
float vptWidth = this->Viewport[2] - this->Viewport[0];
float vptHeight = this->Viewport[3] - this->Viewport[1];
// Round the size up
this->Size[0] = (int) (vptWidth * (float) winSize[0] + 0.5);
this->Size[1] = (int) (vptHeight * (float) winSize[1] + 0.5);
}
else
this->Size[0] = this->Size[1] = 0;
return this->Size;
}
Hope you agree, so we can correct this.
Greetings, Jorrit.
--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------
More information about the vtkusers
mailing list