From 2bb0f945f9ba250b27c6a91272c6b457db1e7839 Mon Sep 17 00:00:00 2001 From: Fraser Date: Fri, 21 Feb 2014 19:35:34 +0000 Subject: [PATCH] Copy to correct offset. Offset into image is y * stride, not y * bpp. --- Source/Examples/OpenTK/GameWindow/MouseCursorSimple.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Examples/OpenTK/GameWindow/MouseCursorSimple.cs b/Source/Examples/OpenTK/GameWindow/MouseCursorSimple.cs index 347643c8..0c78cfc2 100644 --- a/Source/Examples/OpenTK/GameWindow/MouseCursorSimple.cs +++ b/Source/Examples/OpenTK/GameWindow/MouseCursorSimple.cs @@ -32,8 +32,9 @@ namespace Examples.Tutorial for (int y = 0; y < bitmap.Height; ++y) { var offset = new IntPtr(data.Scan0.ToInt64() + (data.Stride * y)); + var stride = bitmap.Width * 4; System.Runtime.InteropServices.Marshal.Copy( - offset, rgba, y * 4, bitmap.Width * 4); + offset, rgba, y * stride, stride); } var cursor = new OpenTK.MouseCursor(rgba, bitmap.Width, bitmap.Height, 0, 0);