Author: pbartok
Date: 2006-01-19 18:58:51 -0500 (Thu, 19 Jan 2006)
New Revision: 55802
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Cursor.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
Log:
2006-01-19 Peter Dennis Bartok <[EMAIL PROTECTED]>
* XplatUIWin32.cs, Cursor.cs: Fixed code that wrongly assumed
that the stride for the GDI bitmap would match the stride of
a DIB or a Cursor.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-01-19 23:53:38 UTC (rev 55801)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-01-19 23:58:51 UTC (rev 55802)
@@ -1,3 +1,9 @@
+2006-01-19 Peter Dennis Bartok <[EMAIL PROTECTED]>
+
+ * XplatUIWin32.cs, Cursor.cs: Fixed code that wrongly assumed
+ that the stride for the GDI bitmap would match the stride of
+ a DIB or a Cursor.
+
2006-01-19 Alexander Olk <[EMAIL PROTECTED]>
* ThemeGtk.cs: Added ProgressBar, RadioButton, CheckBox
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Cursor.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Cursor.cs
2006-01-19 23:53:38 UTC (rev 55801)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Cursor.cs
2006-01-19 23:58:51 UTC (rev 55802)
@@ -632,6 +632,7 @@
BitmapData bits;
ColorPalette pal;
int biHeight;
+ int bytesPerLine;
if (cursor_data == null) {
return new Bitmap(32, 32);
@@ -697,10 +698,11 @@
}
}
+ bytesPerLine = (int)((((cih.biWidth *
cih.biBitCount) + 31) & ~31) >> 3);
bits = bmp.LockBits(new Rectangle(0, 0,
bmp.Width, bmp.Height), ImageLockMode.WriteOnly, bmp.PixelFormat);
for (int y = 0; y < biHeight; y++) {
- Marshal.Copy(ci.cursorXOR, bits.Stride
* y, (IntPtr)((int)bits.Scan0 + bits.Stride * (biHeight - 1 - y)), bits.Stride);
+ Marshal.Copy(ci.cursorXOR, bytesPerLine
* y, (IntPtr)((int)bits.Scan0 + bits.Stride * (biHeight - 1 - y)),
bytesPerLine);
}
bmp.UnlockBits(bits);
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
2006-01-19 23:53:38 UTC (rev 55801)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
2006-01-19 23:58:51 UTC (rev 55802)
@@ -724,6 +724,7 @@
ColorPalette pal;
int[] palette;
byte[] imagebits;
+ int bytesPerLine;
bmi =
(BITMAPINFOHEADER)Marshal.PtrToStructure(dib_data, typeof(BITMAPINFOHEADER));
@@ -780,13 +781,14 @@
}
}
+ bytesPerLine = (int)((((bmi.biWidth * bmi.biBitCount) +
31) & ~31) >> 3);
bits = bmp.LockBits(new Rectangle(0, 0, bmp.Width,
bmp.Height), ImageLockMode.WriteOnly, bmp.PixelFormat);
- imagebits = new byte[bits.Stride];
+ imagebits = new byte[bytesPerLine];
for (int y = 0; y < bmi.biHeight; y++) {
// Copy from source to managed
- Marshal.Copy((IntPtr)((int)dib_data +
Marshal.SizeOf(typeof(BITMAPINFOHEADER)) + palette.Length * 4 + bits.Stride *
y), imagebits, 0, bits.Stride);
+ Marshal.Copy((IntPtr)((int)dib_data +
Marshal.SizeOf(typeof(BITMAPINFOHEADER)) + palette.Length * 4 + bytesPerLine *
y), imagebits, 0, bytesPerLine);
// Copy from managed to dest
Marshal.Copy(imagebits, 0,
(IntPtr)((int)bits.Scan0 + bits.Stride * (bmi.biHeight - 1 - y)),
imagebits.Length);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches