Axiom.RenderSystems.OpenGLES.GLESHardwarePixelBuffer.BlitToMemory C# (CSharp) Method

BlitToMemory() public method

public BlitToMemory ( BasicBox srcBox, PixelBox dst ) : void
srcBox Axiom.Media.BasicBox
dst Axiom.Media.PixelBox
return void
		public override void BlitToMemory( BasicBox srcBox, PixelBox dst )
		{
			if ( !_buffer.Contains( srcBox ) )
			{
				throw new ArgumentOutOfRangeException( "source boux out of range" );
			}

			if ( srcBox.Left == 0 && srcBox.Right == Width &&
				srcBox.Top == 0 && srcBox.Bottom == Height &&
				srcBox.Front == 0 && srcBox.Back == Depth &&
				dst.Width == Width &&
				dst.Height == Height &&
				dst.Depth == Depth &&
				GLESPixelUtil.GetGLOriginFormat( dst.Format ) != 0 )
			{
				// The direct case: the user wants the entire texture in a format supported by GL
				// so we don't need an intermediate buffer
				Download( dst );
			}
			else
			{
				// Use buffer for intermediate copy
				AllocateBuffer();
				//download entire buffer
				Download( _buffer );
				if ( srcBox.Width != dst.Width ||
					srcBox.Height != dst.Height ||
					srcBox.Depth != dst.Depth )
				{
					// we need scaling
					Image.Scale( _buffer.GetSubVolume( srcBox ), dst, ImageFilter.Bilinear );
				}
				else
				{
					// Just copy the bit that we need
					PixelConverter.BulkPixelConversion( _buffer.GetSubVolume( srcBox ), dst );
				}
				FreeBuffer();
			}
		}