From 3bf984be3af6ab4e186ba2ffa5f218d8e5a926fb Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Thu, 1 Nov 2007 23:21:03 +0000 Subject: [PATCH] Removed Dictionary to reduce memory usage. The dictionary can be built by the user. --- Source/OpenTK/TexturePacker.cs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/OpenTK/TexturePacker.cs b/Source/OpenTK/TexturePacker.cs index 7d39f34d..292173e8 100644 --- a/Source/OpenTK/TexturePacker.cs +++ b/Source/OpenTK/TexturePacker.cs @@ -14,7 +14,7 @@ namespace OpenTK { class TexturePacker where T : IPackable { - Dictionary items = new Dictionary(); + //Dictionary items = new Dictionary(); Node root; @@ -48,7 +48,7 @@ namespace OpenTK throw new InvalidOperationException("The item is too large for this TexturePacker"); Node node; - if (!items.ContainsKey(item)) + //if (!items.ContainsKey(item)) { node = root.Insert(item); @@ -56,7 +56,7 @@ namespace OpenTK if (node == null) throw new InvalidOperationException("There is not enough space to add this item. Consider calling the Clear() method."); - items.Add(item, node); + //items.Add(item, node); return node.Rect; } throw new ArgumentException("The item already exists in the TexturePacker.", "item"); @@ -72,16 +72,16 @@ namespace OpenTK /// The item to search for. /// The bounding box of the item, if the item exists. /// True if the item exists, false otherwise. - public bool Find(T item, out Rectangle rect) - { - Node node; - bool found = items.TryGetValue(item, out node); - if (found) - rect = node.Rect; - else - rect = new Rectangle(); - return found; - } + //public bool Find(T item, out Rectangle rect) + //{ + // Node node; + // bool found = items.TryGetValue(item, out node); + // if (found) + // rect = node.Rect; + // else + // rect = new Rectangle(); + // return found; + //} #endregion @@ -92,7 +92,7 @@ namespace OpenTK /// public void Clear() { - items.Clear(); + //items.Clear(); root.Clear(); }