* ColorMatrix.cs: Make it have Sequential layout.
[mono.git] / mcs / class / System.Drawing / System.Drawing.Imaging / ImageCodecInfo.cs
index 8c2a54caac8086f69e079284c7ff8f249d333cab..9acb4236407762cb1a3984de3930ac22afea98b5 100644 (file)
@@ -65,9 +65,8 @@ namespace System.Drawing.Imaging {
                // methods              
                public static ImageCodecInfo[] GetImageDecoders() 
                {                       
-                       int decoderNums, arraySize, decoder_ptr, decoder_size;
-                       IntPtr decoders;
-                       ImageCodecInfo codecinfo = new ImageCodecInfo();
+                       int decoderNums, arraySize, decoder_size;
+                       IntPtr decoders, decoder_ptr;
                        ImageCodecInfo[] result;
                        GdipImageCodecInfo gdipdecoder = new GdipImageCodecInfo();
                        Status status;
@@ -86,11 +85,11 @@ namespace System.Drawing.Imaging {
                        GDIPlus.CheckStatus (status);
                        
                        decoder_size = Marshal.SizeOf (gdipdecoder);                    
-                       decoder_ptr = decoders.ToInt32();
+                       decoder_ptr = decoders;
                        
-                       for (int i = 0; i < decoderNums; i++, decoder_ptr += decoder_size)
+                       for (int i = 0; i < decoderNums; i++, decoder_ptr = new IntPtr (decoder_ptr.ToInt64 () + decoder_size))
                        {
-                               gdipdecoder = (GdipImageCodecInfo) Marshal.PtrToStructure ((IntPtr)decoder_ptr, typeof (GdipImageCodecInfo));                                           
+                               gdipdecoder = (GdipImageCodecInfo) Marshal.PtrToStructure (decoder_ptr, typeof (GdipImageCodecInfo));   
                                result[i] = new ImageCodecInfo ();
                                GdipImageCodecInfo.MarshalTo (gdipdecoder, result[i]);                          
                        }
@@ -102,9 +101,8 @@ namespace System.Drawing.Imaging {
                
                public static ImageCodecInfo[] GetImageEncoders() 
                {
-                       int encoderNums, arraySize, encoder_ptr, encoder_size;
-                       IntPtr encoders;
-                       ImageCodecInfo codecinfo = new ImageCodecInfo();
+                       int encoderNums, arraySize, encoder_size;
+                       IntPtr encoders, encoder_ptr;
                        ImageCodecInfo[] result;
                        GdipImageCodecInfo gdipencoder = new GdipImageCodecInfo();
                        Status status;
@@ -118,16 +116,17 @@ namespace System.Drawing.Imaging {
                                return result;                  
                        
                        /* Get encoders list*/
-                       encoders = Marshal.AllocHGlobal (arraySize);                                            
+                       encoders = Marshal.AllocHGlobal (arraySize);
+                       
                        status = GDIPlus.GdipGetImageEncoders (encoderNums,  arraySize, encoders);
                        GDIPlus.CheckStatus (status);
                        
                        encoder_size = Marshal.SizeOf (gdipencoder);                    
-                       encoder_ptr = encoders.ToInt32();
+                       encoder_ptr = encoders;
                        
-                       for (int i = 0; i < encoderNums; i++, encoder_ptr += encoder_size)
+                       for (int i = 0; i < encoderNums; i++, encoder_ptr = new IntPtr (encoder_ptr.ToInt64 () + encoder_size))
                        {
-                               gdipencoder = (GdipImageCodecInfo) Marshal.PtrToStructure ((IntPtr)encoder_ptr, typeof (GdipImageCodecInfo));                                           
+                               gdipencoder = (GdipImageCodecInfo) Marshal.PtrToStructure (encoder_ptr, typeof (GdipImageCodecInfo));                                           
                                result[i] = new ImageCodecInfo ();
                                GdipImageCodecInfo.MarshalTo (gdipencoder, result[i]);                          
                        }