+ if( mNativeImage )
+ {
+ DALI_LOG_ERROR( "OpenGL ES does not support uploading data to native texture\n");
+ }
+ else
+ {
+ unsigned int pixelDataSize = pixelData->GetWidth()*pixelData->GetHeight();
+ if( pixelData->GetBuffer() == NULL || pixelDataSize == 0 )
+ {
+ DALI_LOG_ERROR( "PixelData is empty\n");
+ }
+ else
+ {
+ Pixel::Format pixelDataFormat = pixelData->GetPixelFormat();
+ if( ( pixelDataFormat == mFormat ) || ( (pixelDataFormat == Pixel::RGB888 ) && ( mFormat == Pixel::RGBA8888 ) ) )
+ {
+ if( pixelDataSize < width * height )
+ {
+ DALI_LOG_ERROR( "PixelData of an incorrect size when trying to update texture\n");
+ }
+ else if( ( xOffset + width > ( mSize.GetWidth() / (1u << mipmap) ) ) ||
+ ( yOffset + height > ( mSize.GetHeight() / (1u << mipmap) ) ) )
+ {
+ DALI_LOG_ERROR( "Texture update area out of bounds\n");
+ }
+ else
+ {
+ //Parameters are correct. Send message to upload data to the texture
+ UploadParams params = { static_cast< uint16_t >( layer ),
+ static_cast< uint16_t >( mipmap ),
+ static_cast< uint16_t >( xOffset ),
+ static_cast< uint16_t >( yOffset ),
+ static_cast< uint16_t >( width ),
+ static_cast< uint16_t >( height ) };
+ UploadTextureMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, pixelData, params );
+
+ // Request event processing and update forcely
+ mEventThreadServices.GetRenderController().RequestProcessEventsOnIdle( true );
+ mEventThreadServices.ForceNextUpdate();
+
+ result = true;
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR( "Bad format\n");
+ }
+ }
+ }