[Mono-bugs] [Bug 80971][Nor] Changed - Texture brush does not paint anything

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Feb 27 12:11:04 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by sebastien at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=80971

--- shadow/80971	2007-02-27 09:15:40.000000000 -0500
+++ shadow/80971.tmp.30157	2007-02-27 12:11:04.000000000 -0500
@@ -1,12 +1,12 @@
 Bug#: 80971
 Product: Mono: Class Libraries
 Version: 1.2
 OS: unknown
 OS Details: 
-Status: NEW   
+Status: ASSIGNED   
 Resolution: 
 Severity: Unknown
 Priority: Normal
 Component: libgdiplus
 AssignedTo: sebastien at ximian.com                            
 ReportedBy: mitcheloc at gmail.com               
@@ -139,6 +139,85 @@
           }
 
      }
 
 }
 
+
+------- Additional Comments From sebastien at ximian.com  2007-02-27 12:11 -------
+I found the issue. The original image data (not the clone) is being
+used to build the cairo surface - and it may not be available at use time.
+
+I need to test the fix further before committing it to SVN. This
+(smaller) sample test 4 variations. The ones (1, 3) where the bitmap
+is alive works, the other (0, 2) which depends on a disposed original
+don't (without my patch).
+
+using System;
+using System.Drawing;
+
+using System.Drawing.Drawing2D;
+
+using System.Windows.Forms;
+
+
+
+namespace MonoBug {
+
+	public class Form1 : Form {
+
+		TextureBrush tb;
+
+		public Form1 (string[] args)
+		{
+			Rectangle r = new Rectangle (73, 0, 1, 27);
+			switch ((args.Length > 0) ? Int32.Parse (args [0]) : 0) {
+			default:
+			case 0:
+				Image skin0 = Image.FromFile ("skin.jpg");
+				tb = new TextureBrush (skin0, r);
+				break;
+			case 1:
+				Bitmap bmp = new Bitmap ("skin.jpg");
+				Bitmap skin1 = bmp.Clone (r, bmp.PixelFormat);
+				tb = new TextureBrush (skin1);
+
+				break;
+			case 2:
+				Image skin2 = Image.FromFile ("skin.jpg");
+				tb = new TextureBrush (skin2, WrapMode.Tile, r);
+
+				break;
+			case 3:
+				Image img3 = Image.FromFile ("skin.jpg");
+				Bitmap skin3 = (img3 as Bitmap).Clone (r, img3.PixelFormat);
+				tb = new TextureBrush (skin3);
+
+				break;
+			}
+
+		}
+
+
+		protected override void OnPaint (PaintEventArgs e)
+
+		{
+			e.Graphics.FillRectangle (tb, new Rectangle (0, 0, Width, 27));
+
+			base.OnPaint (e);
+
+		}
+
+
+		[STAThread]
+
+		static void Main (string[] args)
+
+		{
+			Application.Run (new Form1 (args));
+
+		}
+
+	}
+
+}
+


More information about the mono-bugs mailing list