Bug in WindowSystem/Box.cs

Nov 11, 2007 at 4:21 AM
Edited Nov 11, 2007 at 4:24 AM
I was working with the Window System today and I noticed an oddity with the Boxes..
I finally tracked it down to what I believe is some incorrect math in Box.cs:

Here is a diff of the change:

diff --git a/WindowSystem/Box.cs b/WindowSystem/Box.cs
index 3016334..6eddb30 100644
--- a/WindowSystem/Box.cs
+++ b/WindowSystem/Box.cs
@@ -183,17 +183,17 @@ namespace WindowSystem
 
             // Left
             sprites[6] = new GUIRect();
-            sprites[6].Source = new Rectangle(source.X, source.Y + cornerSize, cornerSize, source.Height - (3 * cornerSize));
+            sprites[6].Source = new Rectangle(source.X, source.Y + cornerSize, cornerSize, source.Height - (2 * cornerSize));
             sprites[6].Destination = new Rectangle(dimensions.X, dimensions.Y + cornerSize, cornerSize, dimensions.Height - (2 * cornerSize));
 
             // Right
             sprites[7] = new GUIRect();
-            sprites[7].Source = new Rectangle(source.Right - cornerSize, source.Y + cornerSize, cornerSize, source.Height - (3 * cornerSize));
+            sprites[7].Source = new Rectangle(source.Right - cornerSize, source.Y + cornerSize, cornerSize, source.Height - (2 * cornerSize));
             sprites[7].Destination = new Rectangle(dimensions.Right - cornerSize, dimensions.Y + cornerSize, cornerSize, dimensions.Height - (2 * cornerSize));
 
             // Middle
             sprites[8] = new GUIRect();
-            sprites[8].Source = new Rectangle(source.X + cornerSize + 1, source.Y + cornerSize + 1, source.Width - (2 * (cornerSize + 1)), source.Height - (2 * (cornerSize + 1))); ;
+            sprites[8].Source = new Rectangle(source.X + cornerSize, source.Y + cornerSize, source.Width - (2 * cornerSize), source.Height - (2 * cornerSize)); ;
             sprites[8].Destination = new Rectangle(dimensions.X + cornerSize, dimensions.Y + cornerSize, dimensions.Width - (2 * cornerSize), dimensions.Height - (2 * cornerSize));
 
             // Copy over the results
Coordinator
Nov 16, 2007 at 5:22 PM
Thanks for the help. I also noticed that something was broken with the boxes recently, when changing the corner sizes of some controls. I'll get the fix into the next version.

Thanks,
Aaron