diff --git a/cocos2dx/platform/android/CCImage.cpp b/cocos2dx/platform/android/CCImage.cpp index cd6f1deaf7..8c4c636422 100644 --- a/cocos2dx/platform/android/CCImage.cpp +++ b/cocos2dx/platform/android/CCImage.cpp @@ -170,6 +170,7 @@ bool Image::initWithString( _height = (short)dc._height; _preMulti = true; _renderFormat = Texture2D::PixelFormat::RGBA8888; + _dataLen = _width * _height * 4; bRet = true; } while (0); @@ -221,6 +222,7 @@ bool Image::initWithStringShadowStroke( _height = (short)dc._height; _preMulti = true; _renderFormat = Texture2D::PixelFormat::RGBA8888; + _dataLen = _width * _height * 4; // swap the alpha channel (ARGB to RGBA) swapAlphaChannel((unsigned int *)_data, (_width * _height) ); diff --git a/cocos2dx/platform/emscripten/CCImage.cpp b/cocos2dx/platform/emscripten/CCImage.cpp index 3bcac2e11b..f506404307 100644 --- a/cocos2dx/platform/emscripten/CCImage.cpp +++ b/cocos2dx/platform/emscripten/CCImage.cpp @@ -344,6 +344,7 @@ bool Image::initWithString( _height = (short)dc.iMaxLineHeight; _preMulti = true; _renderFormat = Texture2D::PixelFormat::RGBA8888; + _dataLen = _width * _height * 4; bRet = true; diff --git a/cocos2dx/platform/ios/CCImage.mm b/cocos2dx/platform/ios/CCImage.mm index 28cef6faef..556a4abcba 100644 --- a/cocos2dx/platform/ios/CCImage.mm +++ b/cocos2dx/platform/ios/CCImage.mm @@ -375,6 +375,7 @@ bool Image::initWithStringShadowStroke( _renderFormat = Texture2D::PixelFormat::RGBA8888; _preMulti = info.isPremultipliedAlpha; _data = info.data; + _dataLen = _width * _height * 4; return true; } diff --git a/cocos2dx/platform/linux/CCImage.cpp b/cocos2dx/platform/linux/CCImage.cpp index 38a01eff68..9c70245d19 100644 --- a/cocos2dx/platform/linux/CCImage.cpp +++ b/cocos2dx/platform/linux/CCImage.cpp @@ -452,6 +452,7 @@ bool Image::initWithString( _height = (short)dc.iMaxLineHeight; _renderFormat = Texture2D::PixelFormat::RGBA8888; _preMulti = true; + _dataLen = _width * _height * 4; bRet = true; diff --git a/cocos2dx/platform/mac/CCImage.mm b/cocos2dx/platform/mac/CCImage.mm index c10f6981ad..6c52115847 100644 --- a/cocos2dx/platform/mac/CCImage.mm +++ b/cocos2dx/platform/mac/CCImage.mm @@ -222,6 +222,7 @@ bool Image::initWithString( CC_SAFE_DELETE_ARRAY(_data); } _data = info.data; + _dataLen = _width * _height * 4; return true; } diff --git a/cocos2dx/platform/nacl/CCImage.cpp b/cocos2dx/platform/nacl/CCImage.cpp index f59e4ae027..aabffc176d 100644 --- a/cocos2dx/platform/nacl/CCImage.cpp +++ b/cocos2dx/platform/nacl/CCImage.cpp @@ -464,6 +464,7 @@ bool Image::initWithString( _height = (short)dc.iMaxLineHeight; _preMulti = true; _renderFormat = Texture2D::PixelFormat::RGBA8888; + _dataLen = _width * _height * 4; bRet = true; diff --git a/cocos2dx/platform/tizen/CCImage.cpp b/cocos2dx/platform/tizen/CCImage.cpp index a080e2bef0..b2faac43cc 100644 --- a/cocos2dx/platform/tizen/CCImage.cpp +++ b/cocos2dx/platform/tizen/CCImage.cpp @@ -451,6 +451,7 @@ bool Image::initWithString( _height = (short)dc.iMaxLineHeight; _preMulti = true; _renderFormat = Texture2D::PixelFormat::RGBA8888; + _dataLen = _width * _height * 4; bRet = true;