Commit dcd024ed authored by David Gobbi's avatar David Gobbi
Browse files

Merge branch 'stencil-iterator-overrun-6.3' into stencil-iterator-overrun

parents a2ae0a10 2a652eb4
...@@ -111,7 +111,7 @@ void vtkImageStencilIterator<DType>::Initialize( ...@@ -111,7 +111,7 @@ void vtkImageStencilIterator<DType>::Initialize(
if (stencil) if (stencil)
{ {
this->HasStencil = true; this->HasStencil = true;
this->InStencil = true; this->InStencil = false;
this->SpanIndexX = 0; this->SpanIndexX = 0;
this->SpanIndexY = 0; this->SpanIndexY = 0;
...@@ -152,11 +152,15 @@ void vtkImageStencilIterator<DType>::Initialize( ...@@ -152,11 +152,15 @@ void vtkImageStencilIterator<DType>::Initialize(
if (yOffset >= 0) if (yOffset >= 0)
{ {
this->SpanMinY = 0; this->SpanMinY = 0;
// starting partway into the stencil, so add an offset
startOffset += yOffset; startOffset += yOffset;
} }
else else
{ {
this->SpanMinY = -yOffset; this->SpanMinY = -yOffset;
// starting before start of stencil: subtract the increment that
// will be added in NextSpan() upon entry into stencil extent
startOffset -= 1;
} }
if (stencilExtent[3] > extent[3]) if (stencilExtent[3] > extent[3])
...@@ -172,11 +176,18 @@ void vtkImageStencilIterator<DType>::Initialize( ...@@ -172,11 +176,18 @@ void vtkImageStencilIterator<DType>::Initialize(
if (zOffset >= 0) if (zOffset >= 0)
{ {
this->SpanMinZ = 0; this->SpanMinZ = 0;
// starting partway into the stencil, so add an offset
startOffset += zOffset*this->SpanSliceIncrement; startOffset += zOffset*this->SpanSliceIncrement;
} }
else else
{ {
this->SpanMinZ = -zOffset; this->SpanMinZ = -zOffset;
// starting before start of stencil: subtract the increment that
// will be added in NextSpan() upon entry into stencil extent
if (yOffset >= 0)
{
startOffset -= 1 + this->SpanSliceEndIncrement;
}
} }
if (stencilExtent[5] > extent[5]) if (stencilExtent[5] > extent[5])
...@@ -199,14 +210,18 @@ void vtkImageStencilIterator<DType>::Initialize( ...@@ -199,14 +210,18 @@ void vtkImageStencilIterator<DType>::Initialize(
vtkImageStencilIteratorFriendship::GetExtentLists(stencil) + vtkImageStencilIteratorFriendship::GetExtentLists(stencil) +
startOffset; startOffset;
// Holds the current position within the span list for the current row // Get the current position within the span list for the current row
this->SetSpanState(this->SpanMinX); if (yOffset >= 0 && zOffset >= 0)
{
// If starting within stencil extent, check stencil immediately
this->InStencil = true;
this->SetSpanState(this->SpanMinX);
}
} }
else else
{ {
this->SpanCountPointer = 0; this->SpanCountPointer = 0;
this->SpanListPointer = 0; this->SpanListPointer = 0;
this->InStencil = false;
} }
} }
else else
......
Supports Markdown
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