Axiom.RenderSystems.OpenGL.GLHardwarePixelBuffer.BlitFromMemory C# (CSharp) Method

BlitFromMemory() public method

public BlitFromMemory ( PixelBox src, BasicBox dstBox ) : void
src Axiom.Media.PixelBox
dstBox Axiom.Media.BasicBox
return void
		public override void BlitFromMemory( PixelBox src, BasicBox dstBox )
		{
			PixelBox scaled;

			if ( !_buffer.Contains( dstBox ) )
				throw new ArgumentException( "Destination box out of range." );

			if ( src.Width != dstBox.Width ||
				 src.Height != dstBox.Height ||
				 src.Depth != dstBox.Depth )
			{
				// Scale to destination size. Use DevIL and not iluScale because ILU screws up for
				// floating point textures and cannot cope with 3D images.
				// This also does pixel format conversion if needed
				allocateBuffer();
				scaled = _buffer.GetSubVolume( dstBox );

				Image.Scale( src, scaled, ImageFilter.Bilinear );
			}
			else if ( GLPixelUtil.GetGLOriginFormat( src.Format ) == 0 )
			{
				// Extents match, but format is not accepted as valid source format for GL
				// do conversion in temporary buffer
				allocateBuffer();
				scaled = _buffer.GetSubVolume( dstBox );
				PixelConverter.BulkPixelConversion( src, scaled );
			}
			else
			{
				// No scaling or conversion needed
				scaled = src;
				// Set extents for upload
				scaled.Left = dstBox.Left;
				scaled.Right = dstBox.Right;
				scaled.Top = dstBox.Top;
				scaled.Bottom = dstBox.Bottom;
				scaled.Front = dstBox.Front;
				scaled.Back = dstBox.Back;
			}

			upload( scaled );
			freeBuffer();
		}