From dceff2d179d9e90ed2a08f9fcb583613d5b8ce50 Mon Sep 17 00:00:00 2001 From: yangws Date: Mon, 28 Mar 2011 11:09:49 +0800 Subject: [PATCH] issue #396 android modified. --- cocos2dx/platform/CCThread.h | 2 +- cocos2dx/platform/android/CCImage_android.cpp | 10 +++++----- cocos2dx/platform/android/CCThread_android.cpp | 5 +---- cocos2dx/platform/win32/CCThread_win32.cpp | 1 + cocos2dx/platform/wophone/CCThread_wophone.cpp | 1 + cocos2dx/textures/CCTexture2D.cpp | 4 ++-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/cocos2dx/platform/CCThread.h b/cocos2dx/platform/CCThread.h index aeebfc5426..681d3fc614 100644 --- a/cocos2dx/platform/CCThread.h +++ b/cocos2dx/platform/CCThread.h @@ -46,7 +46,7 @@ public: private: class Impl; - ccxScopedPtr m_pImp; + CCLock::Impl * m_pImp; }; #else // CC_SUPPORT_MULTITHREAD diff --git a/cocos2dx/platform/android/CCImage_android.cpp b/cocos2dx/platform/android/CCImage_android.cpp index c165b371a1..95f8f24d3c 100644 --- a/cocos2dx/platform/android/CCImage_android.cpp +++ b/cocos2dx/platform/android/CCImage_android.cpp @@ -233,12 +233,12 @@ bool CCImage::initWithString( CC_BREAK_IF(nWidth <= 0 || nHeight <= 0); int nDataLen = pBitmap->rowBytes() * pBitmap->height(); - m_pData.reset(new ccxByte[nDataLen]); - CC_BREAK_IF(! m_pData.get()); - memcpy((void*) m_pData.get(), pBitmap->getPixels(), nDataLen); + m_pData = new unsigned char[nDataLen]; + CC_BREAK_IF(! m_pData); + memcpy((void*) m_pData, pBitmap->getPixels(), nDataLen); - m_nWidth = (ccxInt16)nWidth; - m_nHeight = (ccxInt16)nHeight; + m_nWidth = (short)nWidth; + m_nHeight = (short)nHeight; m_bHasAlpha = true; m_bPreMulti = true; m_nBitsPerComponent = pBitmap->bytesPerPixel(); diff --git a/cocos2dx/platform/android/CCThread_android.cpp b/cocos2dx/platform/android/CCThread_android.cpp index 537eb7690d..cff54e0af2 100644 --- a/cocos2dx/platform/android/CCThread_android.cpp +++ b/cocos2dx/platform/android/CCThread_android.cpp @@ -52,10 +52,7 @@ CCLock::CCLock() CCLock::~CCLock() { - if (m_pImp) - { - delete m_pImp; - } + CC_SAFE_DELETE(m_pImp); } void CCLock::lock() diff --git a/cocos2dx/platform/win32/CCThread_win32.cpp b/cocos2dx/platform/win32/CCThread_win32.cpp index 50419432d3..27a1c4df65 100644 --- a/cocos2dx/platform/win32/CCThread_win32.cpp +++ b/cocos2dx/platform/win32/CCThread_win32.cpp @@ -46,6 +46,7 @@ CCXLock::CCXLock() CCXLock::~CCXLock() { + CC_SAFE_DELETE(m_pImp); } void CCXLock::lock() diff --git a/cocos2dx/platform/wophone/CCThread_wophone.cpp b/cocos2dx/platform/wophone/CCThread_wophone.cpp index 3633eb75a4..5c1ea0f4cc 100644 --- a/cocos2dx/platform/wophone/CCThread_wophone.cpp +++ b/cocos2dx/platform/wophone/CCThread_wophone.cpp @@ -58,6 +58,7 @@ CCLock::CCLock() CCLock::~CCLock() { + CC_SAFE_DELETE(m_pImp); } void CCLock::lock() diff --git a/cocos2dx/textures/CCTexture2D.cpp b/cocos2dx/textures/CCTexture2D.cpp index 089cf7520d..3b7bf6b8e9 100644 --- a/cocos2dx/textures/CCTexture2D.cpp +++ b/cocos2dx/textures/CCTexture2D.cpp @@ -128,11 +128,11 @@ namespace cocos2d { case kCCTexture2DPixelFormat_RGB5A1: case kCCTexture2DPixelFormat_RGB565: case kCCTexture2DPixelFormat_A8: - vt->data = new ccxByte[w * h * 4]; + vt->data = new unsigned char[w * h * 4]; memcpy(vt->data, d, w * h * 4); break; case kCCTexture2DPixelFormat_RGB888: - vt->data = new ccxByte[w * h * 3]; + vt->data = new unsigned char[w * h * 3]; memcpy(vt->data, d, w * h * 3); break; }