mirror of https://github.com/axmolengine/axmol.git
android fixes
This commit is contained in:
parent
b532ce74d8
commit
a095635459
|
@ -140,6 +140,9 @@ base/pvr.cpp \
|
||||||
base/s3tc.cpp \
|
base/s3tc.cpp \
|
||||||
base/CCController.cpp \
|
base/CCController.cpp \
|
||||||
base/CCController-android.cpp \
|
base/CCController-android.cpp \
|
||||||
|
base/allocator/CCAllocatorDiagnostics.cpp \
|
||||||
|
base/allocator/CCAllocatorGlobal.cpp \
|
||||||
|
base/allocator/CCAllocatorGlobalNewDelete.cpp \
|
||||||
base/ObjectFactory.cpp \
|
base/ObjectFactory.cpp \
|
||||||
renderer/CCBatchCommand.cpp \
|
renderer/CCBatchCommand.cpp \
|
||||||
renderer/CCCustomCommand.cpp \
|
renderer/CCCustomCommand.cpp \
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "platform/CCPlatformMacros.h"
|
#include "platform/CCPlatformMacros.h"
|
||||||
#include "base/allocator/CCAllocatorMacros.h"
|
#include "base/allocator/CCAllocatorMacros.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
NS_CC_ALLOCATOR_BEGIN
|
NS_CC_ALLOCATOR_BEGIN
|
||||||
|
|
|
@ -52,10 +52,9 @@ protected:
|
||||||
AllocatorMutex _mutex;
|
AllocatorMutex _mutex;
|
||||||
AllocatorBase* _allocators;
|
AllocatorBase* _allocators;
|
||||||
};
|
};
|
||||||
|
#endif//CC_ENABLE_ALLOCATOR_DIAGNOSTICS
|
||||||
#endif
|
|
||||||
|
|
||||||
NS_CC_ALLOCATOR_END
|
NS_CC_ALLOCATOR_END
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
||||||
#endif//CC_ENABLE_ALLOCATOR_DIAGNOSTICS
|
#endif//CC_ALLOCATOR_DIAGNOSTICS_H
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
USING_NS_CC_ALLOCATOR;
|
USING_NS_CC_ALLOCATOR;
|
||||||
|
|
||||||
|
#if CC_ENABLE_ALLOCATOR
|
||||||
#if CC_ENABLE_ALLOCATOR_GLOBAL_NEW_DELETE
|
#if CC_ENABLE_ALLOCATOR_GLOBAL_NEW_DELETE
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -42,8 +43,10 @@ namespace
|
||||||
void* operator new[] (std::size_t size)
|
void* operator new[] (std::size_t size)
|
||||||
{
|
{
|
||||||
void* ptr = global.allocate(size);
|
void* ptr = global.allocate(size);
|
||||||
|
#if CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID
|
||||||
if (nullptr == ptr)
|
if (nullptr == ptr)
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
|
#endif
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +54,10 @@ void* operator new[] (std::size_t size)
|
||||||
void* operator new(std::size_t size)
|
void* operator new(std::size_t size)
|
||||||
{
|
{
|
||||||
void* ptr = global.allocate(size);
|
void* ptr = global.allocate(size);
|
||||||
|
#if CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID
|
||||||
if (nullptr == ptr)
|
if (nullptr == ptr)
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
|
#endif
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,3 +69,4 @@ void operator delete(void* p) throw()
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CC_ENABLE_ALLOCATOR_GLOBAL_NEW_DELETE
|
#endif // CC_ENABLE_ALLOCATOR_GLOBAL_NEW_DELETE
|
||||||
|
#endif // CC_ENABLE_ALLOCATOR
|
||||||
|
|
|
@ -182,7 +182,9 @@ public:
|
||||||
ALLOCATE(13, 8192);
|
ALLOCATE(13, 8192);
|
||||||
default:
|
default:
|
||||||
CC_ASSERT(false);
|
CC_ASSERT(false);
|
||||||
|
#if CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,21 +263,23 @@ public:
|
||||||
|
|
||||||
switch (adjusted_size)
|
switch (adjusted_size)
|
||||||
{
|
{
|
||||||
DEALLOCATE(2, 4, address);
|
DEALLOCATE(2, 4, address);
|
||||||
DEALLOCATE(3, 8, address);
|
DEALLOCATE(3, 8, address);
|
||||||
DEALLOCATE(4, 16, address);
|
DEALLOCATE(4, 16, address);
|
||||||
DEALLOCATE(5, 32, address);
|
DEALLOCATE(5, 32, address);
|
||||||
DEALLOCATE(6, 64, address);
|
DEALLOCATE(6, 64, address);
|
||||||
DEALLOCATE(7, 128, address);
|
DEALLOCATE(7, 128, address);
|
||||||
DEALLOCATE(8, 256, address);
|
DEALLOCATE(8, 256, address);
|
||||||
DEALLOCATE(9, 512, address);
|
DEALLOCATE(9, 512, address);
|
||||||
DEALLOCATE(10, 1024, address);
|
DEALLOCATE(10, 1024, address);
|
||||||
DEALLOCATE(11, 2048, address);
|
DEALLOCATE(11, 2048, address);
|
||||||
DEALLOCATE(12, 4096, address);
|
DEALLOCATE(12, 4096, address);
|
||||||
DEALLOCATE(13, 8192, address);
|
DEALLOCATE(13, 8192, address);
|
||||||
default:
|
default:
|
||||||
CC_ASSERT(false);
|
CC_ASSERT(false);
|
||||||
throw std::bad_alloc();
|
#if CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID
|
||||||
|
throw std::bad_alloc();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef DEALLOCATE
|
#undef DEALLOCATE
|
||||||
|
|
|
@ -12,4 +12,4 @@
|
||||||
|
|
||||||
android.library=true
|
android.library=true
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-10
|
target=android-19
|
||||||
|
|
Loading…
Reference in New Issue