Add FrameRenderedCallback and FramePresentedCallback 95/238695/1
authorDongsug Song <dongsug.song@samsung.com>
Wed, 8 Jul 2020 12:02:08 +0000 (21:02 +0900)
committerDongsug Song <dongsug.song@samsung.com>
Thu, 16 Jul 2020 09:29:36 +0000 (18:29 +0900)
- csharp binding for DALi DevelWindow's AddFrameRenderedCallback and AddFramePresentedCallback
- TestCase will not be added in tizen CSharp-TCT, but they were added in NUI test sample to do TDD
- paired with https://github.com/Samsung/TizenFX/pull/1811

Change-Id: I8ed2d1b82a4430138b644107678dd86b7d3ff29e

dali-csharp-binder/src/window.cpp

index 5287679..3e20e54 100644 (file)
@@ -3422,6 +3422,80 @@ SWIGEXPORT int32_t SWIGSTDCALL CSharp_Dali_Window_GetNativeId( void* jarg1 )
   return ret;
 }
 
+SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Window_AddFrameRenderedCallback( void* nuiWindow, void* nuiCallback, int nuiFrameId )
+{
+  Dali::Window* window = (Dali::Window*)nuiWindow;
+  void (*callback)(int32_t) = (void (*)(int32_t))nuiCallback;
+
+  if( !window || !callback )
+  {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null", 0);
+    return;
+  }
+
+  try
+  {
+    Dali::DevelWindow::AddFrameRenderedCallback( *window, std::unique_ptr< Dali::CallbackBase >( Dali::MakeCallback( callback ) ), nuiFrameId );
+  }
+  catch( std::out_of_range& e )
+  {
+    SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what()));
+    return;
+  }
+  catch( std::exception& e )
+  {
+    SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what()));
+    return;
+  }
+  catch( Dali::DaliException e )
+  {
+    SWIG_CSharpException(SWIG_UnknownError, e.condition);
+    return;
+  }
+  catch(...)
+  {
+    SWIG_CSharpException(SWIG_UnknownError, "unknown error");
+    return;
+  }
+}
+
+SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Window_AddFramePresentedCallback( void* nuiWindow, void* nuiCallback, int nuiFrameId )
+{
+  Dali::Window* window = (Dali::Window*)nuiWindow;
+  void (*callback)(int32_t) = (void (*)(int32_t))nuiCallback;
+
+  if( !window || !callback )
+  {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null", 0);
+    return;
+  }
+
+  try
+  {
+    Dali::DevelWindow::AddFramePresentedCallback( *window, std::unique_ptr< Dali::CallbackBase >( Dali::MakeCallback( callback ) ), nuiFrameId );
+  }
+  catch( std::out_of_range& e )
+  {
+    SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what()));
+    return;
+  }
+  catch( std::exception& e )
+  {
+    SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what()));
+    return;
+  }
+  catch( Dali::DaliException e )
+  {
+    SWIG_CSharpException(SWIG_UnknownError, e.condition);
+    return;
+  }
+  catch(...)
+  {
+    SWIG_CSharpException(SWIG_UnknownError, "unknown error");
+    return;
+  }
+}
+
 #ifdef __cplusplus
 }
 #endif