projects
/
platform
/
core
/
uifw
/
dali-adaptor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "[4.0] When native image is destroyed, It call TriggerEventInterface callback."
[platform/core/uifw/dali-adaptor.git]
/
adaptors
/
tizen
/
native-image-source-impl-tizen.cpp
diff --git
a/adaptors/tizen/native-image-source-impl-tizen.cpp
b/adaptors/tizen/native-image-source-impl-tizen.cpp
index
fe249e5
..
3afb87b
100755
(executable)
--- a/
adaptors/tizen/native-image-source-impl-tizen.cpp
+++ b/
adaptors/tizen/native-image-source-impl-tizen.cpp
@@
-22,6
+22,7
@@
#include <dali/integration-api/debug.h>
#include <dali/integration-api/gl-defines.h>
#include <cstring>
#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>
// INTERNAL INCLUDES
#include <gl/egl-image-extensions.h>
@@
-30,7
+31,6
@@
#include <render-surface.h>
// Allow this to be encoded and saved:
#include <render-surface.h>
// Allow this to be encoded and saved:
-#include <platform-abstractions/tizen/resource-loader/resource-loader.h>
#include <bitmap-saver.h>
namespace Dali
#include <bitmap-saver.h>
namespace Dali
@@
-99,6
+99,7
@@
NativeImageSource::NativeImageSource( unsigned int width, unsigned int height, D
if( mTbmSurface != NULL )
{
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 );
mBlendingRequired = CheckBlending( tbm_surface_get_format( mTbmSurface ) );
mWidth = tbm_surface_get_width( mTbmSurface );
mHeight = tbm_surface_get_height( mTbmSurface );
@@
-184,13
+185,20
@@
tbm_surface_h NativeImageSource::GetSurfaceFromAny( Any source ) const
NativeImageSource::~NativeImageSource()
{
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" );
}
}
{
DALI_LOG_ERROR( "Failed to destroy tbm_surface\n" );
}
}
+ else
+ {
+ if( mTbmSurface != NULL )
+ {
+ tbm_surface_internal_unref( mTbmSurface );
+ }
+ }
}
Any NativeImageSource::GetNativeImageSource() const
}
Any NativeImageSource::GetNativeImageSource() const
@@
-239,7
+247,7
@@
bool NativeImageSource::GetPixels(std::vector<unsigned char>& pixbuf, unsigned&
{
cOffset = c*3;
offset = cOffset + r*stride;
{
cOffset = c*3;
offset = cOffset + r*stride;
- *(bufptr) = ptr[offset+2];
+ *(bufptr
+cOffset
) = ptr[offset+2];
*(bufptr+cOffset+1) = ptr[offset+1];
*(bufptr+cOffset+2) = ptr[offset];
}
*(bufptr+cOffset+1) = ptr[offset+1];
*(bufptr+cOffset+2) = ptr[offset];
}
@@
-259,7
+267,7
@@
bool NativeImageSource::GetPixels(std::vector<unsigned char>& pixbuf, unsigned&
{
cOffset = c*4;
offset = cOffset + r*stride;
{
cOffset = c*4;
offset = cOffset + r*stride;
- *(bufptr) = ptr[offset+3];
+ *(bufptr
+cOffset
) = ptr[offset+3];
*(bufptr+cOffset+1) = ptr[offset+2];
*(bufptr+cOffset+2) = ptr[offset+1];
*(bufptr+cOffset+3) = ptr[offset];
*(bufptr+cOffset+1) = ptr[offset+2];
*(bufptr+cOffset+2) = ptr[offset+1];
*(bufptr+cOffset+3) = ptr[offset];
@@
-269,11
+277,7
@@
bool NativeImageSource::GetPixels(std::vector<unsigned char>& pixbuf, unsigned&
}
default:
{
}
default:
{
- DALI_LOG_WARNING( "Tbm surface has unsupported pixel format.\n" );
-
- pixbuf.resize( 0 );
- width = 0;
- height = 0;
+ DALI_ASSERT_ALWAYS( 0 && "Tbm surface has unsupported pixel format.\n" );
return false;
}
return false;
}
@@
-310,9
+314,9
@@
bool NativeImageSource::EncodeToFile(const std::string& filename) const
void NativeImageSource::SetSource( Any source )
{
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" );
}
{
DALI_LOG_ERROR( "Failed to destroy tbm_surface\n" );
}
@@
-320,24
+324,25
@@
void NativeImageSource::SetSource( Any source )
mTbmSurface = NULL;
mOwnTbmSurface = false;
}
mTbmSurface = NULL;
mOwnTbmSurface = false;
}
+ else
+ {
+ if( mTbmSurface != NULL )
+ {
+ tbm_surface_internal_unref( mTbmSurface );
+ mTbmSurface = NULL;
+ }
+ }
mTbmSurface = GetSurfaceFromAny( source );
mTbmSurface = GetSurfaceFromAny( source );
- mSetSource = true;
if( mTbmSurface != NULL )
{
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 );
}
mBlendingRequired = CheckBlending( tbm_surface_get_format( mTbmSurface ) );
mWidth = tbm_surface_get_width( mTbmSurface );
mHeight = tbm_surface_get_height( mTbmSurface );
}
-
- if( mEglImageKHRContainer.Size() > 2 )
- {
- mEglImageExtensions->DestroyImageKHR(mEglImageKHRContainer[0]);
- mEglImageKHRContainer.Erase( mEglImageKHRContainer.Begin() );
- }
-
- mEglImageKHRContainer.PushBack( mEglImageKHR );
}
bool NativeImageSource::IsColorDepthSupported( Dali::NativeImageSource::ColorDepth colorDepth )
}
bool NativeImageSource::IsColorDepthSupported( Dali::NativeImageSource::ColorDepth colorDepth )
@@
-395,7
+400,11
@@
bool NativeImageSource::GlExtensionCreate()
{
// casting from an unsigned int to a void *, which should then be cast back
// to an unsigned int in the driver.
{
// casting from an unsigned int to a void *, which should then be cast back
// to an unsigned int in the driver.
- EGLClientBuffer eglBuffer = reinterpret_cast< EGLClientBuffer > (mTbmSurface);
+ EGLClientBuffer eglBuffer = reinterpret_cast< EGLClientBuffer >(mTbmSurface);
+ if( !eglBuffer )
+ {
+ return false;
+ }
mEglImageKHR = mEglImageExtensions->CreateImageKHR( eglBuffer );
mEglImageKHR = mEglImageExtensions->CreateImageKHR( eglBuffer );
@@
-404,9
+413,12
@@
bool NativeImageSource::GlExtensionCreate()
void NativeImageSource::GlExtensionDestroy()
{
void NativeImageSource::GlExtensionDestroy()
{
- mEglImageExtensions->DestroyImageKHR(mEglImageKHR);
+ if( mEglImageKHR )
+ {
+ mEglImageExtensions->DestroyImageKHR(mEglImageKHR);
- mEglImageKHR = NULL;
+ mEglImageKHR = NULL;
+ }
}
unsigned int NativeImageSource::TargetTexture()
}
unsigned int NativeImageSource::TargetTexture()
@@
-418,9
+430,17
@@
unsigned int NativeImageSource::TargetTexture()
void NativeImageSource::PrepareTexture()
{
void NativeImageSource::PrepareTexture()
{
- if( mSetSource
&& GlExtensionCreate()
)
+ if( mSetSource )
{
{
- TargetTexture();
+ void* eglImage = mEglImageKHR;
+
+ if( GlExtensionCreate() )
+ {
+ TargetTexture();
+ }
+
+ mEglImageExtensions->DestroyImageKHR( eglImage );
+
mSetSource = false;
}
}
mSetSource = false;
}
}