Commit 1af4e233 authored by David Gobbi's avatar David Gobbi Committed by Kitware Robot
Browse files

Merge topic 'reslice-mapper-faster'

0e77e36c ENH: Remove old checkerboarding code.
parents 0df5258d 0e77e36c
......@@ -427,32 +427,3 @@ void vtkImageSliceMapper::GetDimensionIndices(
}
}
}
//----------------------------------------------------------------------------
void vtkImageSliceMapper::CheckerboardImage(
unsigned char *data, int xsize, int ysize,
const double imageSpacing[3], vtkImageProperty *property)
{
// Get the imagedata dims that correspond to the texture "x" and "y"
int xdim, ydim;
this->GetDimensionIndices(this->Orientation, xdim, ydim);
// Get the checkerboard spacing and the offset fraction
double spacing[2], offset[2];
property->GetCheckerboardSpacing(spacing);
property->GetCheckerboardOffset(offset);
// Adjust the spacing according to the image data spacing, add a tolerance
// to prefer rounding up since ties happen often and can cause different
// platforms/compilers to give different results
spacing[0] = floor(spacing[0]/imageSpacing[xdim] + 0.50000762939453125);
spacing[1] = floor(spacing[1]/imageSpacing[ydim] + 0.50000762939453125);
// Center the checkerboard at the image center, because it looks nice
offset[0] = floor(0.5*xsize + spacing[0]*offset[0] + 0.50000762939453125);
offset[1] = floor(0.5*ysize + spacing[1]*offset[1] + 0.50000762939453125);
// Note that spacing has been converted to integer spacing
vtkImageMapper3D::CheckerboardRGBA(
data, xsize, ysize, offset[0], offset[1], spacing[0], spacing[1]);
}
......@@ -154,12 +154,6 @@ protected:
// Get the dimension indices according to the orientation.
static void GetDimensionIndices(int orientation, int &xdim, int &ydim);
// Description:
// Do a checkerboard pattern to the alpha of an RGBA image
void CheckerboardImage(
unsigned char *data, int xsize, int ysize,
const double imageSpacing[3], vtkImageProperty *property);
vtkTimeStamp LoadTime;
int SliceNumber;
int SliceNumberMinValue;
......
......@@ -232,28 +232,19 @@ void vtkOpenGLImageSliceMapper::RenderTexturedPolygon(
renWin->GetContextCreationTime() > loadTime ||
recursive)
{
// whether to try to use the input data directly as the texture
bool reuseData = true;
if (checkerboard && !useFragmentProgram && !this->ExactPixelMatch)
{
reuseData = false;
}
// get the data to load as a texture
int xsize = this->TextureSize[0];
int ysize = this->TextureSize[1];
int bytesPerPixel = this->TextureBytesPerPixel;
// whether to try to use the input data directly as the texture
bool reuseData = true;
// generate the data to be used as a texture
unsigned char *data = this->MakeTextureData(
(this->PassColorData ? 0 : property), input, extent, xsize, ysize,
bytesPerPixel, reuseTexture, reuseData);
// software fallback for checkerboarding the image
if (checkerboard && !useFragmentProgram && !this->ExactPixelMatch)
{
this->CheckerboardImage(data, xsize, ysize, spacing, property);
}
GLuint tempIndex = 0;
#ifdef GL_VERSION_1_1
......
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