From 296a0b73d0d308e8e0135ae4c632558a6bc54074 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Tue, 9 Jan 2007 20:59:40 +0000 Subject: [PATCH] 2007-01-09 Mike Kestner * sample/GtkDemo/DemoPixbuf.cs : use Marshal.Copy properly to avoid expose crashes. Revised from patch provided by Fabian Sturm. [#78262] svn path=/trunk/gtk-sharp/; revision=70738 --- ChangeLog | 6 ++++++ sample/GtkDemo/DemoPixbuf.cs | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 24a0a5db3..a29efc50f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-01-09 Mike Kestner + + * sample/GtkDemo/DemoPixbuf.cs : use Marshal.Copy properly + to avoid expose crashes. Revised from patch provided by + Fabian Sturm. [#78262] + 2007-01-09 Mike Kestner * sample/GtkDemo/DemoIconView.cs : use Gtk.Stock icons to avoid diff --git a/sample/GtkDemo/DemoPixbuf.cs b/sample/GtkDemo/DemoPixbuf.cs index eab0ec2f2..a1ae4a1b8 100644 --- a/sample/GtkDemo/DemoPixbuf.cs +++ b/sample/GtkDemo/DemoPixbuf.cs @@ -80,7 +80,8 @@ namespace GtkDemo rowstride = frame.Rowstride; pixels = new byte[(frame.Height - area.Y) * rowstride]; - Marshal.Copy (frame.Pixels, pixels, rowstride * area.Y + area.X * 3, pixels.Length); + IntPtr src = (IntPtr)(frame.Pixels.ToInt64 () + rowstride * area.Y + area.X * 3); + Marshal.Copy (src, pixels, 0, pixels.Length); widget.GdkWindow.DrawRgbImageDithalign (widget.Style.BlackGC, area.X, area.Y, area.Width, area.Height,