#include <dali/integration-api/debug.h>
#include <dali/integration-api/gl-defines.h>
#include <cstring>
+#include <tbm_surface_internal.h>
// INTERNAL INCLUDES
#include <gl/egl-image-extensions.h>
if( mTbmSurface != NULL )
{
+ tbm_surface_internal_ref( mTbmSurface );
mBlendingRequired = CheckBlending( tbm_surface_get_format( mTbmSurface ) );
mWidth = tbm_surface_get_width( mTbmSurface );
mHeight = tbm_surface_get_height( mTbmSurface );
NativeImageSource::~NativeImageSource()
{
- if( mOwnTbmSurface && mTbmSurface != NULL )
+ if( mOwnTbmSurface )
{
- if( tbm_surface_destroy( mTbmSurface ) != TBM_SURFACE_ERROR_NONE )
+ if( mTbmSurface != NULL && tbm_surface_destroy( mTbmSurface ) != TBM_SURFACE_ERROR_NONE )
{
DALI_LOG_ERROR( "Failed to destroy tbm_surface\n" );
}
}
+ else
+ {
+ if( mTbmSurface != NULL )
+ {
+ tbm_surface_internal_unref( mTbmSurface );
+ }
+ }
}
Any NativeImageSource::GetNativeImageSource() const
void NativeImageSource::SetSource( Any source )
{
- if( mOwnTbmSurface && mTbmSurface != NULL )
+ if( mOwnTbmSurface )
{
- if( tbm_surface_destroy( mTbmSurface ) != TBM_SURFACE_ERROR_NONE )
+ if( mTbmSurface != NULL && tbm_surface_destroy( mTbmSurface ) != TBM_SURFACE_ERROR_NONE )
{
DALI_LOG_ERROR( "Failed to destroy tbm_surface\n" );
}
mTbmSurface = NULL;
mOwnTbmSurface = false;
}
+ else
+ {
+ if( mTbmSurface != NULL )
+ {
+ tbm_surface_internal_unref( mTbmSurface );
+ mTbmSurface = NULL;
+ }
+ }
mTbmSurface = GetSurfaceFromAny( source );
- mSetSource = true;
if( mTbmSurface != NULL )
{
+ mSetSource = true;
+ tbm_surface_internal_ref( mTbmSurface );
mBlendingRequired = CheckBlending( tbm_surface_get_format( mTbmSurface ) );
mWidth = tbm_surface_get_width( mTbmSurface );
mHeight = tbm_surface_get_height( mTbmSurface );