+uint8_t* NativeImageSourceTizen::AcquireBuffer( uint16_t& width, uint16_t& height, uint16_t& stride )
+{
+ Dali::Mutex::ScopedLock lock( mMutex );
+ if( mTbmSurface != NULL )
+ {
+ tbm_surface_info_s info;
+
+ if( tbm_surface_map( mTbmSurface, TBM_SURF_OPTION_READ, &info) != TBM_SURFACE_ERROR_NONE )
+ {
+ DALI_LOG_ERROR( "Fail to map tbm_surface\n" );
+
+ width = 0;
+ height = 0;
+
+ return NULL;
+ }
+ tbm_surface_internal_ref( mTbmSurface );
+ mIsBufferAcquired = true;
+
+ stride = info.planes[0].stride;
+ width = mWidth;
+ height = mHeight;
+
+ return info.planes[0].ptr;
+ }
+ return NULL;
+}
+
+
+bool NativeImageSourceTizen::ReleaseBuffer()
+{
+ Dali::Mutex::ScopedLock lock( mMutex );
+ bool ret = false;
+ if( mTbmSurface != NULL )
+ {
+ ret = ( tbm_surface_unmap( mTbmSurface ) == TBM_SURFACE_ERROR_NONE );
+ if( !ret )
+ {
+ DALI_LOG_ERROR( "Fail to unmap tbm_surface\n" );
+ }
+ tbm_surface_internal_unref( mTbmSurface );
+ mIsBufferAcquired = false;
+ }
+ return ret;
+}
+
+void NativeImageSourceTizen::SetResourceDestructionCallback(EventThreadCallback* callback)
+{
+ mResourceDestructionCallback = std::unique_ptr<EventThreadCallback>(callback);
+}
+