Index: vtkRendererSource.cxx
===================================================================
RCS file: /cvsroot/vtkmirror/VTK/Rendering/vtkRendererSource.cxx,v
retrieving revision 1.62
diff -u -r1.62 vtkRendererSource.cxx
--- vtkRendererSource.cxx	4 Mar 2005 17:08:27 -0000	1.62
+++ vtkRendererSource.cxx	28 Mar 2006 21:10:24 -0000
@@ -26,6 +26,7 @@
 #include "vtkRenderer.h"
 #include "vtkStreamingDemandDrivenPipeline.h"
 #include "vtkUnsignedCharArray.h"
+#include "vtkMath.h"
 
 vtkCxxRevisionMacro(vtkRendererSource, "$Revision: 1.62 $");
 vtkStandardNewMacro(vtkRendererSource);
@@ -59,7 +60,7 @@
                                     vtkInformationVector* outputVector)
 {
   int numOutPts;
-  float x1,y1,x2,y2;
+  int x1,y1,x2,y2;
   unsigned char *pixels, *ptr;
   int dims[3];
   
@@ -109,32 +110,27 @@
     }
   
   // calc the pixel range for the renderer
-  x1 = this->Input->GetViewport()[0]*
-    ((this->Input->GetRenderWindow())->GetSize()[0] - 1);
-  y1 = this->Input->GetViewport()[1]*
-    ((this->Input->GetRenderWindow())->GetSize()[1] - 1);
-  x2 = this->Input->GetViewport()[2]*
-    ((this->Input->GetRenderWindow())->GetSize()[0] - 1);
-  y2 = this->Input->GetViewport()[3]*
-    ((this->Input->GetRenderWindow())->GetSize()[1] - 1);
+  x1 = vtkMath::Round(this->Input->GetViewport()[0] * (this->Input->GetRenderWindow()->GetSize()[0] - 1));
+  y1 = vtkMath::Round(this->Input->GetViewport()[1] * (this->Input->GetRenderWindow()->GetSize()[1] - 1));
+  x2 = vtkMath::Round(this->Input->GetViewport()[2] * (this->Input->GetRenderWindow()->GetSize()[0] - 1));
+  y2 = vtkMath::Round(this->Input->GetViewport()[3] * (this->Input->GetRenderWindow()->GetSize()[1] - 1));
 
   if (this->WholeWindow)
     {
     x1 = 0;
     y1 = 0;
-    x2 = (this->Input->GetRenderWindow())->GetSize()[0] - 1;
-    y2 = (this->Input->GetRenderWindow())->GetSize()[1] - 1;
+    x2 = this->Input->GetRenderWindow()->GetSize()[0] - 1;
+    y2 = this->Input->GetRenderWindow()->GetSize()[1] - 1;
     }
   
   // Get origin, aspect ratio and dimensions from this->Input
-  dims[0] = (int)(x2 - x1 + 1); dims[1] = (int)(y2 -y1 + 1); dims[2] = 1;
+  dims[0] = x2 - x1 + 1; dims[1] = y2 -y1 + 1; dims[2] = 1;
   output->SetDimensions(dims);
 
   // Allocate data.  Scalar type is FloatScalars.
   numOutPts = dims[0] * dims[1];
 
-  pixels = (this->Input->GetRenderWindow())->GetPixelData((int)x1,(int)y1,
-                                                          (int)x2,(int)y2,1);
+  pixels = (this->Input->GetRenderWindow())->GetPixelData(x1,y1,x2,y2,1);
 
   // allocate scalars
   int nb_comp = output->GetNumberOfScalarComponents();
@@ -292,21 +288,22 @@
       }
 
     // calc the pixel range for the renderer
-    float x1,y1,x2,y2;
-    x1 = ren->GetViewport()[0] * ((ren->GetRenderWindow())->GetSize()[0] - 1);
-    y1 = ren->GetViewport()[1] * ((ren->GetRenderWindow())->GetSize()[1] - 1);
-    x2 = ren->GetViewport()[2] * ((ren->GetRenderWindow())->GetSize()[0] - 1);
-    y2 = ren->GetViewport()[3] *((ren->GetRenderWindow())->GetSize()[1] - 1);
+    int x1,y1,x2,y2;
+
+    x1 = vtkMath::Round(ren->GetViewport()[0] * (ren->GetRenderWindow()->GetSize()[0] - 1));
+    y1 = vtkMath::Round(ren->GetViewport()[1] * (ren->GetRenderWindow()->GetSize()[1] - 1));
+    x2 = vtkMath::Round(ren->GetViewport()[2] * (ren->GetRenderWindow()->GetSize()[0] - 1));
+    y2 = vtkMath::Round(ren->GetViewport()[3] * (ren->GetRenderWindow()->GetSize()[1] - 1));
+
     if (this->WholeWindow)
       {
       x1 = 0;
       y1 = 0;
-      x2 = (this->Input->GetRenderWindow())->GetSize()[0] - 1;
-      y2 = (this->Input->GetRenderWindow())->GetSize()[1] - 1;
-      }    
-    int extent[6] = {0, static_cast<int>(x2-x1), 
-                     0, static_cast<int>(y2-y1), 
-                     0, 0};
+      x2 = this->Input->GetRenderWindow()->GetSize()[0] - 1;
+      y2 = this->Input->GetRenderWindow()->GetSize()[1] - 1;
+      }
+
+    int extent[6] = { 0, x2-x1, 0, y2-y1, 0, 0 };
 
   // get the info objects
   vtkInformation* outInfo = outputVector->GetInformationObject(0);
