package bdv.viewer.render;

import net.imglib2.RandomAccessibleInterval;
import net.imglib2.type.numeric.NumericType;
import net.imglib2.ui.util.StopWatch;
import net.imglib2.view.Views;

public class EmptyProjector< T extends NumericType< T> > implements VolatileProjector
{
	private final RandomAccessibleInterval< T > target;

	private volatile boolean valid = false;

    protected long lastFrameRenderNanoTime;

    public EmptyProjector( final RandomAccessibleInterval< T > screenImage )
	{
		this.target = screenImage;
		lastFrameRenderNanoTime = -1;
	}

	@Override
	public boolean map()
	{
		return map( false );
	}

	@Override
	public boolean map( final boolean clearUntouchedTargetPixels )
	{
		final StopWatch stopWatch = new StopWatch();
		stopWatch.start();
		for ( final T t : Views.iterable( target ) )
			t.setZero();
		lastFrameRenderNanoTime = stopWatch.nanoTime();
		return true;
	}

	@Override
	public long getLastFrameRenderNanoTime()
	{
		return lastFrameRenderNanoTime;
	}

	@Override
	public void cancel()
	{}

	@Override
	public boolean isValid()
	{
		return valid;
	}
}
@@ -327,50 +327,8 @@
 t;%0A%0A
-%09private volatile boolean valid = false;%0A%0A
     
@@ -722,16 +722,53 @@
 tart();%0A
+%09%09if ( clearUntouchedTargetPixels )%0A%09
 %09%09for ( 
@@ -806,16 +806,17 @@
 get ) )%0A
+%09
 %09%09%09t.set
@@ -1077,13 +1077,12 @@
 urn 
-valid
+true
 ;%0A%09%7D

fix valid and clearUntouchedTargetPixels flags in EmptyProjector