From 3069b77fb47a405ae810f2a9b092a02c69808317 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Thu, 8 Nov 2007 15:54:07 +0000 Subject: [PATCH] Changed the definition of the TexturePacker.Add() method, to reduce generated garbage. --- Source/OpenTK/TexturePacker.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/OpenTK/TexturePacker.cs b/Source/OpenTK/TexturePacker.cs index 3b170ec7..ab7492f6 100644 --- a/Source/OpenTK/TexturePacker.cs +++ b/Source/OpenTK/TexturePacker.cs @@ -40,7 +40,7 @@ namespace OpenTK /// A System.Drawing.Rectangle containing the coordinates of the packed item. /// Occurs if the item is larger than the available TexturePacker area /// Occurs if the item already exists in the TexturePacker. - public Rectangle Add(T item) + public void Add(T item, out Rectangle rect) { if (item.Width > root.Rect.Width || item.Height > root.Rect.Height) throw new InvalidOperationException("The item is too large for this TexturePacker"); @@ -55,7 +55,7 @@ namespace OpenTK throw new InvalidOperationException("There is not enough space to add this item. Consider calling the Clear() method."); //items.Add(item, node); - return node.Rect; + rect = node.Rect; } //throw new ArgumentException("The item already exists in the TexturePacker.", "item"); }