From 80d684b83fdee48c7197b2ff6dfec3800e724f36 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 27 Jan 2015 09:38:32 +1100 Subject: [PATCH] Remove non RGBA pixel accessors. --- FastBitmap.cs | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/FastBitmap.cs b/FastBitmap.cs index 3d26db5be..5e606a742 100644 --- a/FastBitmap.cs +++ b/FastBitmap.cs @@ -34,37 +34,6 @@ namespace ClassicalSharp { } } - unsafe class _32bppRGBAccessor : PixelAccessor { - - public override int GetPixel( int x, int y ) { - int* row = (int*)( scan0 + ( y * stride ) ); - return row[x] & 0xFFFFFF; - } - - public override void SetPixel( int x, int y, int col ) { - int* row = (int*)( scan0 + ( y * stride ) ); - row[x] = col & 0xFFFFFF; - } - } - - // TODO: test this actually works correctly. - unsafe class _24bppRGBAccessor : PixelAccessor { - - public override int GetPixel( int x, int y ) { - byte* row = scan0 + ( y * stride ); - int i = x * 3; // b g r - return row[i] | row[i + 1] << 8 | row[i + 2] << 16 | 255 << 24; - } - - public override void SetPixel( int x, int y, int col ) { - byte* row = scan0 + ( y * stride ); - int i = x * 3; - row[i] = (byte)( col & 0xFF ); - row[i + 1] = (byte)( ( col & 0xFF00 ) >> 8 ); - row[i + 2] = (byte)( ( col & 0xFF0000 ) >> 16 ); - } - } - /// Constructs a new FastBitmap wrapped around the specified Bitmap. /// Bitmap which is wrapped. /// Whether to immediately lock the bits of the bitmap, @@ -117,10 +86,6 @@ namespace ClassicalSharp { PixelFormat format = Bitmap.PixelFormat; if( format == PixelFormat.Format32bppArgb ) { accessor = new _32bppARGBAccessor(); - } else if( format == PixelFormat.Format32bppRgb ) { - accessor = new _32bppRGBAccessor(); - } else if( format == PixelFormat.Format24bppRgb ) { - accessor = new _24bppRGBAccessor(); } else { throw new NotSupportedException( "Unsupported bitmap pixel format:" + format ); }