فهرست منبع

Removed some unused code

Marko Pintera 12 سال پیش
والد
کامیت
3115bd079d
3فایلهای تغییر یافته به همراه3 افزوده شده و 61 حذف شده
  1. 1 43
      CamelotUtility/Include/CmMemoryAllocator.h
  2. 1 1
      CamelotUtility/Source/CmFileSystem.cpp
  3. 1 17
      TODO.txt

+ 1 - 43
CamelotUtility/Include/CmMemoryAllocator.h

@@ -36,48 +36,6 @@ namespace CamelotFramework
 		}
 		}
 	};
 	};
 
 
-	template<class T, class category>
-	class MemAllocDeleter
-	{
-	public:
-		static void deleter(T* ptr)
-		{
-			cm_delete<category, T>(ptr);
-		}
-	};
-
-	template<class category>
-	class MemAllocBytesDeleter
-	{
-	public:
-		static void deleter(void* ptr)
-		{
-			MemoryAllocator<category>::free(ptr);
-		}
-	};
-
-	template<class T, class category> 
-	inline T* __cm_construct_array(UINT32 count)
-	{
-		T* ptr = (T*)MemoryAllocator<category>::allocateArray(sizeof(T), count);
-
-		for(unsigned int i = 0; i < count; i++)
-			new ((void*)&ptr[i]) T;
-
-		return ptr;
-	}
-
-	template<class T, class category> 
-	inline void __cm_destruct_array(T* ptr, UINT32 count)
-	{
-		// This might seem a bit weird if T is a built-in type or a pointer, but
-		// standard allows us to call destructor on such types (they don't do anything)
-		for(unsigned int i = 0; i < count; i++)
-			ptr[i].~T();
-
-		MemoryAllocator<category>::freeArray(ptr, count);
-	}
-
 	/**
 	/**
 	 * @brief	General allocator provided by the OS. Use for persistent long term allocations,
 	 * @brief	General allocator provided by the OS. Use for persistent long term allocations,
 	 * 			and allocations that don't happen often.
 	 * 			and allocations that don't happen often.
@@ -272,7 +230,7 @@ namespace CamelotFramework
 
 
 namespace CamelotFramework
 namespace CamelotFramework
 {
 {
-	// Allocators we can use in the standard library
+	// Allocator we can use in the standard library
     template <class T, class Alloc = GenAlloc>
     template <class T, class Alloc = GenAlloc>
 	class StdAlloc 
 	class StdAlloc 
 	{
 	{

+ 1 - 1
CamelotUtility/Source/CmFileSystem.cpp

@@ -72,7 +72,7 @@ namespace CamelotFramework
 			// read-only stream
 			// read-only stream
 			stream = cm_new<FileDataStream, ScratchAlloc>(fullPath, roStream, (size_t)tagStat.st_size, true);
 			stream = cm_new<FileDataStream, ScratchAlloc>(fullPath, roStream, (size_t)tagStat.st_size, true);
 		}
 		}
-		return DataStreamPtr(stream, &MemAllocDeleter<FileDataStream, ScratchAlloc>::deleter);
+		return cm_shared_ptr<FileDataStream, ScratchAlloc>(stream);
 	}
 	}
 
 
 	DataStreamPtr FileSystem::create(const String& fullPath)
 	DataStreamPtr FileSystem::create(const String& fullPath)

+ 1 - 17
TODO.txt

@@ -27,7 +27,7 @@ IMMEDIATE:
   - Padding
   - Padding
   - Icon image
   - Icon image
   - Support for text color in GUIStyles
   - Support for text color in GUIStyles
- - Using linear filtering on scale9grid textures doesn't look good, mostly true if the center get stretched a lot (the border colors seep through)
+ - I have disabled linear filtering because it doesn't look good on scale9grid textures. (Add another material so it works with stretched textures?)
  - What happens when I don't set a texture for a state of a GUI element. Use a dummy white texture probably?
  - What happens when I don't set a texture for a state of a GUI element. Use a dummy white texture probably?
     - Make sure GUI system uses a dummy texture if one isn't available
     - Make sure GUI system uses a dummy texture if one isn't available
 	- SpriteTexture keeps a static reference to DUmmyTexture which I need to release before shutdown
 	- SpriteTexture keeps a static reference to DUmmyTexture which I need to release before shutdown
@@ -36,22 +36,6 @@ IMMEDIATE:
   - Add support for bold (and maybe italic) fonts in Font importer
   - Add support for bold (and maybe italic) fonts in Font importer
   - Add support to disable aliasing when importing font
   - Add support to disable aliasing when importing font
 
 
-  fix up cm_new and cm_newN so they don't use placement new and instead manually call constructor through a func ptr so I can call
-   methods with private constructors. HOWEVER this defeats the purpsoe of a private constructor...So maybe just use macro CM_NEW for those objects?
-
-port remaining CM_NEW/CM_DELETE calls
-port std::shared_ptr. Make specialized versions that call CoreObject deleter and MemAlloc deleter.
- - Make sure it uses a custom allocator
-
- get rid of BOOST_PP_COMMA (remove headers referencing it as well)
- get rid of MemAllocDeleter::deleter
-
- maybe also add cm_stack_alloc, cm_stack_freeAll
-and cm_pool_new, cm_pool_delete
-
-
-And when I'm adding allocators to SharedPtr attempt to get rid of ugly-ass custom deleters and make just one easier to use shared_ptr wrapper.
-
 -----------
 -----------
 
 
 I need to be able to provide smaller bounds used for UI input 
 I need to be able to provide smaller bounds used for UI input