#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
-// Allow this to be encoded and saved:
-#include <dali/devel-api/adaptor-framework/bitmap-saver.h>
-
namespace Dali
{
mEglImageExtensions( NULL ),
mSetSource( false ),
mMutex(),
- mIsBufferAcquired( false )
+ mIsBufferAcquired( false ),
+ mResourceDestructionCallback()
{
DALI_ASSERT_ALWAYS( Adaptor::IsAvailable() );
{
cOffset = c*4;
offset = cOffset + r*stride;
- *(bufptr+cOffset) = ptr[offset];
- *(bufptr+cOffset+1) = ptr[offset+3];
- *(bufptr+cOffset+2) = ptr[offset+2];
- *(bufptr+cOffset+3) = ptr[offset+1];
+ *(bufptr+cOffset) = ptr[offset+2];
+ *(bufptr+cOffset+1) = ptr[offset+1];
+ *(bufptr+cOffset+2) = ptr[offset];
+ *(bufptr+cOffset+3) = ptr[offset+3];
}
}
break;
return false;
}
-bool NativeImageSourceTizen::EncodeToFile(const std::string& filename) const
-{
- std::vector< unsigned char > pixbuf;
- unsigned int width(0), height(0);
- Pixel::Format pixelFormat;
-
- if(GetPixels(pixbuf, width, height, pixelFormat))
- {
- return Dali::EncodeToFile(&pixbuf[0], filename, pixelFormat, width, height);
- }
- return false;
-}
-
void NativeImageSourceTizen::SetSource( Any source )
{
Dali::Mutex::ScopedLock lock( mMutex );
return false;
}
-bool NativeImageSourceTizen::GlExtensionCreate()
+bool NativeImageSourceTizen::CreateResource()
{
// casting from an unsigned int to a void *, which should then be cast back
// to an unsigned int in the driver.
return mEglImageKHR != NULL;
}
-void NativeImageSourceTizen::GlExtensionDestroy()
+void NativeImageSourceTizen::DestroyResource()
{
Dali::Mutex::ScopedLock lock( mMutex );
if( mEglImageKHR )
mEglImageKHR = NULL;
}
+
+ if(mResourceDestructionCallback)
+ {
+ mResourceDestructionCallback->Trigger();
+ }
}
uint32_t NativeImageSourceTizen::TargetTexture()
{
void* eglImage = mEglImageKHR;
- if( GlExtensionCreate() )
+ if( CreateResource() )
{
TargetTexture();
}
}
}
-const char* NativeImageSourceTizen::GetCustomFragmentPreFix()
+const char* NativeImageSourceTizen::GetCustomFragmentPrefix() const
{
return FRAGMENT_PREFIX;
}
-const char* NativeImageSourceTizen::GetCustomSamplerTypename()
+const char* NativeImageSourceTizen::GetCustomSamplerTypename() const
{
return SAMPLER_TYPE;
}
-int NativeImageSourceTizen::GetEglImageTextureTarget()
+int NativeImageSourceTizen::GetTextureTarget() const
{
return GL_TEXTURE_EXTERNAL_OES;
}
+Any NativeImageSourceTizen::GetNativeImageHandle() const
+{
+ return GetNativeImageSource();
+}
+
+bool NativeImageSourceTizen::SourceChanged() const
+{
+ return false;
+}
+
bool NativeImageSourceTizen::CheckBlending( tbm_format format )
{
if( mTbmFormat != format )
bool ret = false;
if( mTbmSurface != NULL )
{
- ret = ( tbm_surface_unmap( mTbmSurface ) != TBM_SURFACE_ERROR_NONE );
+ ret = ( tbm_surface_unmap( mTbmSurface ) == TBM_SURFACE_ERROR_NONE );
if( !ret )
{
DALI_LOG_ERROR( "Fail to unmap tbm_surface\n" );
return ret;
}
+void NativeImageSourceTizen::SetResourceDestructionCallback(EventThreadCallback* callback)
+{
+ mResourceDestructionCallback = std::unique_ptr<EventThreadCallback>(callback);
+}
} // namespace Adaptor