From: Dongsug Song Date: Wed, 8 Jul 2020 12:02:08 +0000 (+0900) Subject: Add FrameRenderedCallback and FramePresentedCallback X-Git-Tag: accepted/tizen/unified/20200722.014919~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f8c9f3271717819a5eccf2ae4c35b326903ed06e;p=platform%2Fcore%2Fuifw%2Fdali-csharp-binder.git Add FrameRenderedCallback and FramePresentedCallback - 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 --- diff --git a/dali-csharp-binder/src/window.cpp b/dali-csharp-binder/src/window.cpp index 5287679..3e20e54 100644 --- a/dali-csharp-binder/src/window.cpp +++ b/dali-csharp-binder/src/window.cpp @@ -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(e.what())); + return; + } + catch( std::exception& e ) + { + SWIG_CSharpException(SWIG_RuntimeError, const_cast(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(e.what())); + return; + } + catch( std::exception& e ) + { + SWIG_CSharpException(SWIG_RuntimeError, const_cast(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