Author: toshok
Date: 2006-12-06 23:07:00 -0500 (Wed, 06 Dec 2006)
New Revision: 69152
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
Log:
[ I wanna be like BenM when I grow up ]
* Hwnd.cs: create a single static Graphics object on the static
Bitmap we create. use this for our text measurements.
* Control.cs (DeviceContext): stop using the backbuffer's dc_mem.
This was causing us to allocate a backbuffer for every control,
even when it wasn't flagged as double buffered. Instead use the
single graphics instance. This might have implications for
multithreaded applications. If we run into problems we can switch
to creating 1 Graphics per control, on the static Hwnd bitmap.
this change nets us a 7M savings in private dirty mappings when
running FormsTest.exe.
2006-12-06 Chris Toshok <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-12-07 03:14:14 UTC (rev 69151)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-12-07 04:07:00 UTC (rev 69152)
@@ -1,5 +1,22 @@
2006-12-06 Chris Toshok <[EMAIL PROTECTED]>
+ [ I wanna be like BenM when I grow up ]
+
+ * Hwnd.cs: create a single static Graphics object on the static
+ Bitmap we create. use this for our text measurements.
+
+ * Control.cs (DeviceContext): stop using the backbuffer's dc_mem.
+ This was causing us to allocate a backbuffer for every control,
+ even when it wasn't flagged as double buffered. Instead use the
+ single graphics instance. This might have implications for
+ multithreaded applications. If we run into problems we can switch
+ to creating 1 Graphics per control, on the static Hwnd bitmap.
+
+ this change nets us a 7M savings in private dirty mappings when
+ running FormsTest.exe.
+
+2006-12-06 Chris Toshok <[EMAIL PROTECTED]>
+
* ToolTip.cs: use Visible instead of is_visible.
* TreeView.cs: same.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2006-12-07 03:14:14 UTC (rev 69151)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2006-12-07 04:07:00 UTC (rev 69152)
@@ -915,12 +915,7 @@
}
internal Graphics DeviceContext {
- get {
- if (dc_mem == null) {
- CreateBuffers(this.Width, this.Height);
- }
- return dc_mem;
- }
+ get { return Hwnd.bmp_g; }
}
private void ImageBufferNeedsRedraw () {
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
2006-12-07 03:14:14 UTC (rev 69151)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
2006-12-07 04:07:00 UTC (rev 69152)
@@ -75,6 +75,7 @@
internal bool zombie; /* X11 only flag. true if the
X windows have been destroyed but we haven't been Disposed */
internal Region user_clip;
internal static Bitmap bmp = new Bitmap(1, 1,
System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+ internal static Graphics bmp_g = Graphics.FromImage (bmp);
internal XEventQueue queue;
internal bool no_activate; // For Win32, popup
windows will not steal focus
#endregion // Local Variables
@@ -178,14 +179,9 @@
if (menu != null) {
int menu_height = menu.Rect.Height;
- if (menu_height == 0) {
- Graphics g;
+ if (menu_height == 0)
+ menu_height =
ThemeEngine.Current.CalcMenuBarSize(bmp_g, menu, client_rect.Width);
- g = Graphics.FromImage(bmp);
- menu_height =
ThemeEngine.Current.CalcMenuBarSize(g, menu, client_rect.Width);
- g.Dispose();
- }
-
rect.Y -= menu_height;
rect.Height += menu_height;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches