[Tizen] Add OffscreenApplication
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / native-render-surface-ecore-wl.cpp
index 15a603e..ed8a360 100644 (file)
@@ -54,14 +54,11 @@ Debug::Filter* gNativeSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, fals
 } // unnamed namespace
 
 NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( SurfaceSize surfaceSize, Any surface, bool isTransparent )
-: mSurfaceSize( surfaceSize ),
-  mRenderNotification( NULL ),
+: mRenderNotification( NULL ),
   mGraphics( NULL ),
   mEGL( nullptr ),
   mEGLSurface( nullptr ),
   mEGLContext( nullptr ),
-  mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ),
-  mTbmFormat( isTransparent ? TBM_FORMAT_ARGB8888 : TBM_FORMAT_RGB888 ),
   mOwnSurface( false ),
   mDrawableCompleted( false ),
   mTbmQueue( NULL ),
@@ -72,13 +69,22 @@ NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( SurfaceSize surfaceSize,
 
   if( surface.Empty() )
   {
+    mSurfaceSize = surfaceSize;
+    mColorDepth = isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24;
+    mTbmFormat = isTransparent ? TBM_FORMAT_ARGB8888 : TBM_FORMAT_RGB888;
     CreateNativeRenderable();
   }
   else
   {
-    // check we have a valid type
-    DALI_ASSERT_ALWAYS( ( surface.GetType() == typeid (tbm_surface_queue_h) ) && "Surface type is invalid" );
     mTbmQueue = AnyCast< tbm_surface_queue_h >( surface );
+
+    uint16_t width = static_cast<uint16_t>( tbm_surface_queue_get_width( mTbmQueue ) );
+    uint16_t height = static_cast<uint16_t>( tbm_surface_queue_get_height( mTbmQueue ) );
+    mSurfaceSize = SurfaceSize( width, height );
+
+    mTbmFormat = tbm_surface_queue_get_format( mTbmQueue );
+
+    mColorDepth = ( mTbmFormat == TBM_FORMAT_ARGB8888 ) ? COLOR_DEPTH_32 : COLOR_DEPTH_24;
   }
 }
 
@@ -126,6 +132,11 @@ void NativeRenderSurfaceEcoreWl::WaitUntilSurfaceReplaced()
   mDrawableCompleted = false;
 }
 
+Any NativeRenderSurfaceEcoreWl::GetNativeRenderable()
+{
+  return mTbmQueue;
+}
+
 PositionSize NativeRenderSurfaceEcoreWl::GetPositionSize() const
 {
   return PositionSize( 0, 0, static_cast<int>( mSurfaceSize.GetWidth() ), static_cast<int>( mSurfaceSize.GetHeight() ) );
@@ -312,7 +323,6 @@ void NativeRenderSurfaceEcoreWl::PostRender( bool renderToFbo, bool replacingSur
       mRenderNotification->Trigger();
     }
   }
-
 }
 
 void NativeRenderSurfaceEcoreWl::StopRender()
@@ -348,11 +358,6 @@ Integration::StencilBufferAvailable NativeRenderSurfaceEcoreWl::GetStencilBuffer
   return mGraphics ? mGraphics->GetStencilBufferRequired() : Integration::StencilBufferAvailable::FALSE;
 }
 
-Any NativeRenderSurfaceEcoreWl::GetNativeHandle()
-{
-  return mTbmQueue;
-}
-
 void NativeRenderSurfaceEcoreWl::ReleaseLock()
 {
   if( mThreadSynchronization )